Merge "NNAPI Burst -- HAL VTS tests"
diff --git a/biometrics/face/1.0/types.hal b/biometrics/face/1.0/types.hal
index a488d67..2bcd3d5 100644
--- a/biometrics/face/1.0/types.hal
+++ b/biometrics/face/1.0/types.hal
@@ -281,9 +281,52 @@
     TOO_SIMILAR = 15,
 
     /**
+     * The magnitude of the pan angle of the user’s face with respect to the sensor’s
+     * capture plane is too high.
+     *
+     * The pan angle is defined as the angle swept out by the user’s face turning
+     * their neck left and right. The pan angle would be zero if the user faced the
+     * camera directly.
+     *
+     * The user should be informed to look more directly at the camera.
+     */
+    PAN_TOO_EXTREME = 16,
+
+    /**
+     * The magnitude of the tilt angle of the user’s face with respect to the sensor’s
+     * capture plane is too high.
+     *
+     * The tilt angle is defined as the angle swept out by the user’s face looking up
+     * and down. The pan angle would be zero if the user faced the camera directly.
+     *
+     * The user should be informed to look more directly at the camera.
+     */
+    TILT_TOO_EXTREME = 17,
+
+    /**
+     * The magnitude of the roll angle of the user’s face with respect to the sensor’s
+     * capture plane is too high.
+     *
+     * The roll angle is defined as the angle swept out by the user’s face tilting their head
+     * towards their shoulders to the left and right. The pan angle would be zero if the user
+     * faced the camera directly.
+     *
+     * The user should be informed to look more directly at the camera.
+     */
+    ROLL_TOO_EXTREME = 18,
+
+   /**
+     * The user’s face has been obscured by some object.
+     *
+     * The user should be informed to remove any objects from the line of sight from
+     * the sensor to the user’s face.
+     */
+    FACE_OBSCURED = 19,
+
+    /**
      * Used to enable a vendor-specific acquisition message.
      */
-    VENDOR = 16
+    VENDOR = 20
 };
 
 /**
diff --git a/bluetooth/audio/2.0/Android.bp b/bluetooth/audio/2.0/Android.bp
index 6049fe2..5d67f75 100644
--- a/bluetooth/audio/2.0/Android.bp
+++ b/bluetooth/audio/2.0/Android.bp
@@ -16,13 +16,25 @@
     ],
     types: [
         "AacObjectType",
+        "AacParameters",
+        "AacVariableBitRate",
+        "AptxParameters",
+        "AudioCapabilities",
+        "AudioConfiguration",
         "BitsPerSample",
         "ChannelMode",
+        "CodecCapabilities",
         "CodecConfiguration",
         "CodecType",
         "LdacChannelMode",
+        "LdacParameters",
+        "LdacQualityIndex",
+        "PcmParameters",
         "SampleRate",
+        "SbcAllocMethod",
+        "SbcBlockLength",
         "SbcChannelMode",
+        "SbcParameters",
         "SessionType",
         "Status",
         "TimeSpec",
diff --git a/bluetooth/audio/2.0/IBluetoothAudioPort.hal b/bluetooth/audio/2.0/IBluetoothAudioPort.hal
index 17d13b8..fedc8d3 100644
--- a/bluetooth/audio/2.0/IBluetoothAudioPort.hal
+++ b/bluetooth/audio/2.0/IBluetoothAudioPort.hal
@@ -27,6 +27,9 @@
  *
  * Moreover, the Audio HAL can also get the presentation position of the stream
  * and provide stream metadata.
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
  */
 interface IBluetoothAudioPort {
     /**
diff --git a/bluetooth/audio/2.0/IBluetoothAudioProvider.hal b/bluetooth/audio/2.0/IBluetoothAudioProvider.hal
index bb5eb1b..2b08cc3 100644
--- a/bluetooth/audio/2.0/IBluetoothAudioProvider.hal
+++ b/bluetooth/audio/2.0/IBluetoothAudioProvider.hal
@@ -23,6 +23,9 @@
  *
  * The Bluetooth stack calls methods in this interface to start and end audio
  * sessions and sends callback events to the Audio HAL.
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
  */
 interface IBluetoothAudioProvider {
 
@@ -35,8 +38,10 @@
      * Note: endSession() must be called to unregister this IBluetoothAudioPort
      *
      * @param hostIf An instance of IBluetoothAudioPort for stream control
-     * @param codecConfig The codec configuration negotiated with the remote
-     *    device
+     * @param audioConfig The audio configuration negotiated with the remote
+     *    device. The PCM parameters are set if software based encoding,
+     *    otherwise the correct codec configuration is used for hardware
+     *    encoding.
      *
      * @return status One of the following
      *    SUCCESS if this IBluetoothAudioPort was successfully registered with
@@ -47,10 +52,10 @@
      *        any other reason
      * @return dataMQ The fast message queue for audio data from this provider.
      *    Audio data will be in PCM format as specified by the
-     *    codecConfig.pcmDataConfiguration parameter.
-     *    nullptr if streaming is offloaded to hardware or on failure.
+     *    audioConfig.pcmConfig parameter.
+     *    Invalid if streaming is offloaded to hardware or on failure.
      */
-    startSession(IBluetoothAudioPort hostIf, CodecConfiguration codecConfig)
+    startSession(IBluetoothAudioPort hostIf, AudioConfiguration audioConfig)
                 generates (Status status, fmq_sync<uint8_t> dataMQ);
 
     /**
diff --git a/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.hal b/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.hal
index 56b8594..1025665 100644
--- a/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.hal
+++ b/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.hal
@@ -25,6 +25,9 @@
  * When the Bluetooth stack is ready to create an audio session, it must first
  * obtain the IBluetoothAudioProvider for that session type by calling
  * openProvider().
+ *
+ * Note: For HIDL APIs with a "generates" statement, the callback parameter used
+ * for return value must be invoked synchronously before the API call returns.
  */
 interface IBluetoothAudioProvidersFactory {
 
@@ -43,4 +46,26 @@
      */
     openProvider(SessionType sessionType)
         generates (Status status, IBluetoothAudioProvider provider);
+
+    /**
+     * Gets a list of audio capabilities for a session type.
+     *
+     * For software encoding, the PCM capabilities are returned.
+     * For hardware encoding, the supported codecs and their capabilities are
+     * returned.
+     *
+     * @param sessionType The session type (e.g.
+     *    A2DP_SOFTWARE_ENCODING_DATAPATH).
+     * @return audioCapabilities A list containing all the capabilities
+     *    supported by the sesson type. The capabilities is a list of
+     *    available options when configuring the codec for the session.
+     *    For software encoding it is the PCM data rate.
+     *    For hardware encoding it is the list of supported codecs and their
+     *    capabilities.
+     *    If a provider isn't supported, an empty list should be returned.
+     *    Note: Only one entry should exist per codec when using hardware
+     *    encoding.
+     */
+     getProviderCapabilities(SessionType sessionType)
+         generates (vec<AudioCapabilities> audioCapabilities);
 };
diff --git a/bluetooth/audio/2.0/types.hal b/bluetooth/audio/2.0/types.hal
index 9286948..909dd57 100644
--- a/bluetooth/audio/2.0/types.hal
+++ b/bluetooth/audio/2.0/types.hal
@@ -17,6 +17,14 @@
 package android.hardware.bluetooth.audio@2.0;
 
 /**
+ * The different audio parameter structs are used to provide a method to list
+ * all the Capabilities of a codec as well as to configure the codecs. All
+ * fields are bitfields unless specified. If used as a configuration, only one
+ * bit may be enabled. If used for Capabilities, enable all bits corresponding to
+ * supported features.
+ */
+
+/**
  * POSIX timespec.
  */
 struct TimeSpec {
@@ -85,6 +93,25 @@
     MONO = 0x08,
 };
 
+enum SbcBlockLength : uint8_t {
+    BLOCKS_4 = 0x80,
+    BLOCKS_8 = 0x40,
+    BLOCKS_12 = 0x20,
+    BLOCKS_16 = 0x10,
+};
+
+enum SbcNumSubbands : uint8_t {
+    SUBBAND_4 = 0x08,
+    SUBBAND_8 = 0x04,
+};
+
+enum SbcAllocMethod : uint8_t {
+    /** SNR */
+    ALLOC_MD_S = 0x02,
+    /** Loudness */
+    ALLOC_MD_L = 0x01,
+};
+
 enum AacObjectType : uint8_t {
     /** MPEG-2 Low Complexity. Support is Mandatory. */
     MPEG2_LC = 0x80,
@@ -96,6 +123,11 @@
     MPEG4_SCALABLE = 0x10,
 };
 
+enum AacVariableBitRate : uint8_t {
+    ENABLED = 0x80,
+    DISABLED = 0x00,
+};
+
 enum LdacChannelMode : uint8_t {
     /** Channel Mode: 3 bits */
     UNKNOWN = 0x00,
@@ -104,67 +136,117 @@
     MONO = 0x04,
 };
 
-struct CodecConfiguration {
-    /** Audio PCM data configuration */
-    struct PcmDataConfiguration {
-        /** Sampling rate for encoder */
-        SampleRate sampleRate;
-        /** Bits per sample for encoder */
-        BitsPerSample bitsPerSample;
-        /** Channel mode for encoder */
-        ChannelMode channelMode;
-    } pcmDataConfiguration;
+enum LdacQualityIndex : uint8_t {
+    // 990kbps
+    QUALITY_HIGH = 0x00,
+    // 660kbps
+    QUALITY_MID = 0x01,
+    // 330kbps
+    QUALITY_LOW = 0x02,
+    // Adaptive Bit Rate mode
+    QUALITY_ABR = 0x7F,
+};
 
-    /** Encoded audio data codec configuration. It is used only if the
-     * HAL is responsible for encoding the PCM audio data. */
-    struct EncodedDataConfiguration {
-        /** Bluetooth A2DP codec */
-        CodecType codecType;
-        /**
-         * The encoded audio bitrate in bits / second.
-         * 0x00000000 - The audio bitrate is not specified / unused
-         * 0x00000001 - 0x00FFFFFF - Encoded audio bitrate in bits/second
-         * 0x01000000 - 0xFFFFFFFF - Reserved
-         */
-        uint32_t encodedAudioBitrate;
-        /** Peer MTU (in octets) */
-        uint16_t peerMtu;
-        /** Content protection by SCMS-T */
-        bool isScmstEnabled;
-        safe_union CodecSpecific {
-            /**
-             * SBC Codec specific information
-             * Refer to SBC Codec specific information elements in A2DP v1.3
-             * Profile Specification.
-             */
-            struct SbcData {
-                /** Reserved: 4 bits | Channel Mode: 4 bits */
-                SbcChannelMode channelMode;
-                /** Block length: 4 bits | Subbands: 2 bits | Allocation Method: 2 bits */
-                uint8_t codecParameters;
-                /** Minimum bitpool value */
-                uint8_t minBitpool;
-                /** Maximum bitpool value */
-                uint8_t maxBitpool;
-            } sbcData;
-            struct AacData {
-                /** AAC Object Type */
-                AacObjectType aacObjectType;
-                /** True if Variable Bit Rate is enabled */
-                bool variableBitRateEnabled;
-            } aacData;
-            struct LdacData {
-                /** Reserved: 5 bits | Channel Mode: 3 bits */
-                LdacChannelMode channelMode;
-                /**
-                 * LDAC bitrate index value:
-                 * 0x00 - High
-                 * 0x01 - Mid
-                 * 0x02 - Low
-                 * 0x7F - ABR (Adaptive Bit Rate)
-                 */
-                uint8_t bitrateIndex;
-            } ldacData;
-        } codecSpecific;
-    } encodedDataConfiguration;
+/** Used for Software Encoding audio feed parameters */
+struct PcmParameters {
+    SampleRate sampleRate;
+    ChannelMode channelMode;
+    BitsPerSample bitsPerSample;
+};
+
+/**
+ * Used for Hardware Encoding SBC codec parameters.
+ * minBitpool and maxBitpool are not bitfields.
+ */
+struct SbcParameters {
+    SampleRate sampleRate;
+    SbcChannelMode channelMode;
+    SbcBlockLength blockLength;
+    SbcNumSubbands numSubbands;
+    SbcAllocMethod allocMethod;
+    BitsPerSample bitsPerSample;
+    uint8_t minBitpool;
+    uint8_t maxBitpool;
+};
+
+/** Used for Hardware Encoding AAC codec parameters */
+struct AacParameters {
+    AacObjectType objectType;
+    SampleRate sampleRate;
+    ChannelMode channelMode;
+    AacVariableBitRate variableBitRateEnabled;
+    BitsPerSample bitsPerSample;
+};
+
+/**
+ * Used for Hardware Encoding LDAC codec parameters
+ * Only used when configuring the codec. When Capabilities are requested, this
+ * field is left empty since all qualities must be supported. Not a bitfield.
+ */
+struct LdacParameters {
+    SampleRate sampleRate;
+    LdacChannelMode channelMode;
+    LdacQualityIndex qualityIndex;
+    BitsPerSample bitsPerSample;
+};
+
+/** Used for Hardware Encoding AptX and AptX-HD codec parameters */
+struct AptxParameters {
+    SampleRate sampleRate;
+    ChannelMode channelMode;
+    BitsPerSample bitsPerSample;
+};
+
+/**
+ * Used to specify the capabilities of the codecs supported by Hardware Encoding.
+ * AptX and AptX-HD both use the AptxParameters field.
+ */
+struct CodecCapabilities {
+    CodecType codecType;
+
+    safe_union Capabilities {
+      SbcParameters sbcCapabilities;
+      AacParameters aacCapabilities;
+      LdacParameters ldacCapabilities;
+      AptxParameters aptxCapabilities;
+    } capabilities;
+};
+
+/** Used to specify the capabilities of the different session types. */
+safe_union AudioCapabilities {
+    PcmParameters pcmCapabilities;
+    CodecCapabilities codecCapabilities;
+};
+
+/**
+ * Used to configure a Hardware Encoding session.
+ * AptX and AptX-HD both use the AptxParameters field.
+ */
+struct CodecConfiguration {
+    CodecType codecType;
+    /**
+     * The encoded audio bitrate in bits / second.
+     * 0x00000000 - The audio bitrate is not specified / unused
+     * 0x00000001 - 0x00FFFFFF - Encoded audio bitrate in bits/second
+     * 0x01000000 - 0xFFFFFFFF - Reserved
+     *
+     * The HAL needs to support all legal bitrates for the selected codec.
+     */
+    uint32_t encodedAudioBitrate;
+    /** Peer MTU (in octets) */
+    uint16_t peerMtu;
+    /** Content protection by SCMS-T */
+    bool isScmstEnabled;
+    safe_union CodecSpecific {
+        SbcParameters sbcConfig;
+        AacParameters aacConfig;
+        LdacParameters ldacConfig;
+        AptxParameters aptxConfig;
+    } config;
+};
+
+/** Used to configure either a Hardware or Software Encoding session based on session type */
+safe_union AudioConfiguration {
+    PcmParameters pcmConfig;
+    CodecConfiguration codecConfig;
 };
diff --git a/usb/1.2/vts/OWNERS b/usb/1.2/vts/OWNERS
new file mode 100644
index 0000000..f60d39a
--- /dev/null
+++ b/usb/1.2/vts/OWNERS
@@ -0,0 +1,2 @@
+badhri@google.com
+yim@google.com
diff --git a/usb/1.2/vts/functional/Android.bp b/usb/1.2/vts/functional/Android.bp
new file mode 100644
index 0000000..761d37f
--- /dev/null
+++ b/usb/1.2/vts/functional/Android.bp
@@ -0,0 +1,28 @@
+//
+// Copyright (C) 2019 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: "VtsHalUsbV1_2TargetTest",
+    defaults: ["VtsHalTargetTestDefaults"],
+    srcs: ["VtsHalUsbV1_2TargetTest.cpp"],
+    static_libs: [
+        "android.hardware.usb@1.0",
+        "android.hardware.usb@1.1",
+        "android.hardware.usb@1.2",
+    ],
+    test_suites: ["general-tests"],
+}
+
diff --git a/usb/1.2/vts/functional/VtsHalUsbV1_2TargetTest.cpp b/usb/1.2/vts/functional/VtsHalUsbV1_2TargetTest.cpp
new file mode 100644
index 0000000..7b3dea9
--- /dev/null
+++ b/usb/1.2/vts/functional/VtsHalUsbV1_2TargetTest.cpp
@@ -0,0 +1,380 @@
+/*
+ * Copyright (C) 2019 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 "VtsHalUsbV1_2TargetTest"
+#include <android-base/logging.h>
+
+#include <android/hardware/usb/1.2/IUsb.h>
+#include <android/hardware/usb/1.2/IUsbCallback.h>
+#include <android/hardware/usb/1.2/types.h>
+
+#include <VtsHalHidlTargetCallbackBase.h>
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+#include <log/log.h>
+#include <stdlib.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::usb::V1_0::PortDataRole;
+using ::android::hardware::usb::V1_0::PortMode;
+using ::android::hardware::usb::V1_0::PortPowerRole;
+using ::android::hardware::usb::V1_0::PortRole;
+using ::android::hardware::usb::V1_0::PortRoleType;
+using ::android::hardware::usb::V1_0::Status;
+using ::android::hardware::usb::V1_1::PortMode_1_1;
+using ::android::hardware::usb::V1_1::PortStatus_1_1;
+using ::android::hardware::usb::V1_2::ContaminantDetectionStatus;
+using ::android::hardware::usb::V1_2::ContaminantProtectionMode;
+using ::android::hardware::usb::V1_2::ContaminantProtectionStatus;
+using ::android::hardware::usb::V1_2::IUsb;
+using ::android::hardware::usb::V1_2::IUsbCallback;
+using ::android::hardware::usb::V1_2::PortStatus;
+using ::android::hidl::base::V1_0::IBase;
+
+constexpr char kCallbackNameNotifyPortStatusChange_1_2[] = "notifyPortStatusChange_1_2";
+const int kCallbackIdentifier = 2;
+
+// Worst case wait time 20secs
+#define WAIT_FOR_TIMEOUT std::chrono::milliseconds(20000)
+
+class UsbClientCallbackArgs {
+   public:
+    // The last conveyed status of the USB ports.
+    // Stores information of currentt_data_role, power_role for all the USB ports
+    PortStatus usb_last_port_status;
+
+    // Status of the last role switch operation.
+    Status usb_last_status;
+
+    // Identifier for the usb callback object.
+    // Stores the cookie of the last invoked usb callback object.
+    int last_usb_cookie;
+};
+
+// Callback class for the USB HIDL hal.
+// Usb Hal will call this object upon role switch or port query.
+class UsbCallback : public ::testing::VtsHalHidlTargetCallbackBase<UsbClientCallbackArgs>,
+                    public IUsbCallback {
+    int cookie;
+
+   public:
+    UsbCallback(int cookie) : cookie(cookie){};
+
+    virtual ~UsbCallback() = default;
+
+    // V1_0 Callback method for the port status.
+    // This should not be called so not signalling the Test here assuming that
+    // the test thread will timeout
+    Return<void> notifyPortStatusChange(const hidl_vec<android::hardware::usb::V1_0::PortStatus>&
+                                        /* currentPortStatus */,
+                                        Status /* retval */) override {
+        return Void();
+    };
+
+    // V1_1 Callback method for the port status.
+    // This should not be called so not signalling the Test here assuming that
+    // the test thread will timeout
+    Return<void> notifyPortStatusChange_1_1(const hidl_vec<PortStatus_1_1>& /* currentPortStatus */,
+                                            Status /* retval */) override {
+        return Void();
+    }
+
+    // This callback method should be used.
+    Return<void> notifyPortStatusChange_1_2(const hidl_vec<PortStatus>& currentPortStatus,
+                                            Status retval) override {
+        UsbClientCallbackArgs arg;
+        if (retval == Status::SUCCESS) {
+            arg.usb_last_port_status.status_1_1.status.supportedModes =
+                    currentPortStatus[0].status_1_1.status.supportedModes;
+            arg.usb_last_port_status.status_1_1.status.currentMode =
+                    currentPortStatus[0].status_1_1.status.currentMode;
+            arg.usb_last_port_status.status_1_1.status.portName =
+                    currentPortStatus[0].status_1_1.status.portName;
+            arg.usb_last_port_status.contaminantDetectionStatus =
+                    currentPortStatus[0].contaminantDetectionStatus;
+            arg.usb_last_port_status.contaminantProtectionStatus =
+                    currentPortStatus[0].contaminantProtectionStatus;
+            arg.usb_last_port_status.supportsEnableContaminantPresenceProtection =
+                    currentPortStatus[0].supportsEnableContaminantPresenceProtection;
+            arg.usb_last_port_status.supportsEnableContaminantPresenceDetection =
+                    currentPortStatus[0].supportsEnableContaminantPresenceDetection;
+            arg.usb_last_port_status.supportedContaminantProtectionModes =
+                    currentPortStatus[0].supportedContaminantProtectionModes;
+        }
+        arg.usb_last_status = retval;
+        arg.last_usb_cookie = cookie;
+
+        NotifyFromCallback(kCallbackNameNotifyPortStatusChange_1_2, arg);
+        return Void();
+    }
+
+    // Callback method for the status of role switch operation.
+    // RoleSwitch operation has not changed since V1_0 so leaving
+    // the callback blank here.
+    Return<void> notifyRoleSwitchStatus(const hidl_string& /*portName*/,
+                                        const PortRole& /*newRole*/, Status /*retval*/) override {
+        return Void();
+    };
+};
+
+// Test environment for Usb HIDL HAL.
+class UsbHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+   public:
+    // get the test environment singleton
+    static UsbHidlEnvironment* Instance() {
+        static UsbHidlEnvironment* instance = new UsbHidlEnvironment;
+        return instance;
+    }
+
+    virtual void registerTestServices() override { registerTestService<IUsb>(); }
+};
+
+// The main test class for the USB hidl HAL
+class UsbHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    virtual void SetUp() override {
+        ALOGI(__FUNCTION__);
+        usb = ::testing::VtsHalHidlTargetTestBase::getService<IUsb>();
+        ASSERT_NE(usb, nullptr);
+
+        usb_cb_2 = new UsbCallback(kCallbackIdentifier);
+        ASSERT_NE(usb_cb_2, nullptr);
+        usb_cb_2->SetWaitTimeout(kCallbackNameNotifyPortStatusChange_1_2, WAIT_FOR_TIMEOUT);
+        Return<void> ret = usb->setCallback(usb_cb_2);
+        ASSERT_TRUE(ret.isOk());
+    }
+
+    virtual void TearDown() override { ALOGI("Teardown"); }
+
+    // USB hidl hal Proxy
+    sp<IUsb> usb;
+
+    // Callback objects for usb hidl
+    // Methods of these objects are called to notify port status updates.
+    sp<UsbCallback> usb_cb_1;
+    sp<UsbCallback> usb_cb_2;
+};
+
+/*
+ * Test to see if setCallback on V1_1 callback object succeeds.
+ * Callback oject is created and registered.
+ * Check to see if the hidl transaction succeeded.
+ */
+TEST_F(UsbHidlTest, setCallback) {
+    usb_cb_1 = new UsbCallback(1);
+    ASSERT_NE(usb_cb_1, nullptr);
+    Return<void> ret = usb->setCallback(usb_cb_1);
+    ASSERT_TRUE(ret.isOk());
+}
+
+/*
+ * Check to see if querying type-c
+ * port status succeeds.
+ * HAL service should call notifyPortStatusChange_1_2
+ * instead of notifyPortStatusChange of V1_0/V1_1 interface
+ */
+TEST_F(UsbHidlTest, queryPortStatus) {
+    Return<void> ret = usb->queryPortStatus();
+    ASSERT_TRUE(ret.isOk());
+    auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+    EXPECT_TRUE(res.no_timeout);
+    EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+    EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.currentMode);
+    EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.supportedModes);
+    EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+}
+
+/*
+ * supportedContaminantProtectionModes is immutable.
+ * Check if supportedContaminantProtectionModes changes across queryPortStatus
+ * call.
+ */
+TEST_F(UsbHidlTest, checkSupportedContaminantProtectionModes) {
+    Return<void> ret = usb->queryPortStatus();
+    ASSERT_TRUE(ret.isOk());
+    auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+    EXPECT_TRUE(res.no_timeout);
+    EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+    EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.currentMode);
+    EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.supportedModes);
+    EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+    uint32_t supportedContaminantProtectionModes = static_cast<uint32_t>(
+            res.args->usb_last_port_status.supportedContaminantProtectionModes);
+    for (int runs = 1; runs <= 10; runs++) {
+        ret = usb->queryPortStatus();
+        ASSERT_TRUE(ret.isOk());
+        res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+        EXPECT_TRUE(res.no_timeout);
+        EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+        EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.currentMode);
+        EXPECT_EQ(PortMode::NONE, res.args->usb_last_port_status.status_1_1.status.supportedModes);
+        EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+        EXPECT_EQ(supportedContaminantProtectionModes,
+                  static_cast<uint32_t>(
+                          res.args->usb_last_port_status.supportedContaminantProtectionModes));
+    }
+}
+
+/*
+ * When supportsEnableContaminantPresenceDetection is set false,
+ * enableContaminantPresenceDetection should not enable/disable
+ * contaminantPresenceProtection.
+ */
+TEST_F(UsbHidlTest, presenceDetectionSupportedCheck) {
+    Return<void> ret = usb->queryPortStatus();
+    ASSERT_TRUE(ret.isOk());
+    auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+    EXPECT_TRUE(res.no_timeout);
+    EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+    EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+    if (!res.args->usb_last_port_status.supportsEnableContaminantPresenceDetection) {
+        for (int runs = 1; runs <= 10; runs++) {
+            bool currentStatus = !(res.args->usb_last_port_status.contaminantDetectionStatus ==
+                                   ContaminantDetectionStatus::DISABLED);
+
+            ret = usb->enableContaminantPresenceDetection(
+                    res.args->usb_last_port_status.status_1_1.status.portName, !currentStatus);
+            ASSERT_TRUE(ret.isOk());
+
+            res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+            EXPECT_TRUE(res.no_timeout);
+            EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+            EXPECT_EQ(currentStatus, !(res.args->usb_last_port_status.contaminantDetectionStatus ==
+                                       ContaminantDetectionStatus::DISABLED));
+        }
+    }
+}
+
+/*
+ * enableContaminantPresenceDetection should succeed atleast 90% when supported.
+ */
+TEST_F(UsbHidlTest, contaminantPresenceDetectionStability) {
+    int successCount = 0;
+    bool currentStatus;
+    bool supported = true;
+
+    Return<void> ret = usb->queryPortStatus();
+    ASSERT_TRUE(ret.isOk());
+    auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+    EXPECT_TRUE(res.no_timeout);
+    EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+    EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+    if (!res.args->usb_last_port_status.supportsEnableContaminantPresenceDetection) return;
+
+    for (int count = 1; count <= 10; count++) {
+        currentStatus = !(res.args->usb_last_port_status.contaminantDetectionStatus ==
+                          ContaminantDetectionStatus::DISABLED);
+
+        ret = usb->enableContaminantPresenceDetection(
+                res.args->usb_last_port_status.status_1_1.status.portName, !currentStatus);
+        ASSERT_TRUE(ret.isOk());
+        res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+        EXPECT_TRUE(res.no_timeout);
+        EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+        if (!currentStatus == !(res.args->usb_last_port_status.contaminantDetectionStatus ==
+                                ContaminantDetectionStatus::DISABLED))
+            successCount++;
+    }
+
+    if (!supported) EXPECT_GE(successCount, 9);
+}
+
+/*
+ * When supportsEnableContaminantPresenceProtection is set false,
+ * enableContaminantPresenceProtection should not enable/disable
+ * contaminantPresenceProtection.
+ */
+TEST_F(UsbHidlTest, presenceProtectionSupportedCheck) {
+    Return<void> ret = usb->queryPortStatus();
+    ASSERT_TRUE(ret.isOk());
+    auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+    EXPECT_TRUE(res.no_timeout);
+    EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+    EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+    if (!res.args->usb_last_port_status.supportsEnableContaminantPresenceProtection) {
+        for (int runs = 1; runs <= 10; runs++) {
+            bool currentStatus = !(res.args->usb_last_port_status.contaminantProtectionStatus ==
+                                   ContaminantProtectionStatus::DISABLED);
+
+            ret = usb->enableContaminantPresenceProtection(
+                    res.args->usb_last_port_status.status_1_1.status.portName, !currentStatus);
+            ASSERT_TRUE(ret.isOk());
+
+            res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+            EXPECT_TRUE(res.no_timeout);
+            EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+            EXPECT_EQ(currentStatus, !(res.args->usb_last_port_status.contaminantProtectionStatus ==
+                                       ContaminantProtectionStatus::DISABLED));
+        }
+    }
+}
+
+/*
+ * enableContaminantPresenceProtection should succeed atleast 90% when supported.
+ */
+TEST_F(UsbHidlTest, contaminantPresenceProtectionStability) {
+    int successCount = 0;
+    bool currentStatus;
+    bool supported = true;
+
+    Return<void> ret = usb->queryPortStatus();
+    ASSERT_TRUE(ret.isOk());
+    auto res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+    EXPECT_TRUE(res.no_timeout);
+    EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+    EXPECT_EQ(Status::SUCCESS, res.args->usb_last_status);
+
+    if (!res.args->usb_last_port_status.supportsEnableContaminantPresenceProtection) return;
+
+    for (int count = 1; count <= 10; count++) {
+        currentStatus = !(res.args->usb_last_port_status.contaminantProtectionStatus ==
+                          ContaminantProtectionStatus::DISABLED);
+
+        ret = usb->enableContaminantPresenceProtection(
+                res.args->usb_last_port_status.status_1_1.status.portName, !currentStatus);
+        ASSERT_TRUE(ret.isOk());
+        res = usb_cb_2->WaitForCallback(kCallbackNameNotifyPortStatusChange_1_2);
+        EXPECT_TRUE(res.no_timeout);
+        EXPECT_EQ(kCallbackIdentifier, res.args->last_usb_cookie);
+        if (!currentStatus == !(res.args->usb_last_port_status.contaminantProtectionStatus ==
+                                ContaminantProtectionStatus::DISABLED))
+            successCount++;
+    }
+
+    if (!supported) EXPECT_GE(successCount, 9);
+}
+
+int main(int argc, char** argv) {
+    ::testing::AddGlobalTestEnvironment(UsbHidlEnvironment::Instance());
+    ::testing::InitGoogleTest(&argc, argv);
+    UsbHidlEnvironment::Instance()->init(&argc, argv);
+    int status = RUN_ALL_TESTS();
+    ALOGI("Test result = %d", status);
+    return status;
+}
diff --git a/wifi/hostapd/1.0/vts/OWNERS b/wifi/hostapd/1.0/vts/OWNERS
new file mode 100644
index 0000000..8bfb148
--- /dev/null
+++ b/wifi/hostapd/1.0/vts/OWNERS
@@ -0,0 +1,2 @@
+rpius@google.com
+etancohen@google.com
diff --git a/wifi/hostapd/1.0/vts/functional/Android.bp b/wifi/hostapd/1.0/vts/functional/Android.bp
index 79c5183..93867d2 100644
--- a/wifi/hostapd/1.0/vts/functional/Android.bp
+++ b/wifi/hostapd/1.0/vts/functional/Android.bp
@@ -24,6 +24,7 @@
     static_libs: [
         "VtsHalWifiV1_0TargetTestUtil",
         "android.hardware.wifi.hostapd@1.0",
+        "android.hardware.wifi.hostapd@1.1",
         "android.hardware.wifi@1.0",
         "libcrypto",
         "libgmock",
@@ -43,6 +44,7 @@
         "VtsHalWifiV1_0TargetTestUtil",
         "VtsHalWifiHostapdV1_0TargetTestUtil",
         "android.hardware.wifi.hostapd@1.0",
+        "android.hardware.wifi.hostapd@1.1",
         "android.hardware.wifi@1.0",
         "libcrypto",
         "libgmock",
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
index 504f4c8..fa780f9 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test.cpp
@@ -138,9 +138,11 @@
  * Access point creation should pass.
  */
 TEST_F(HostapdHidlTest, AddPskAccessPointWithAcs) {
-    auto status = HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithAcs(),
-                              getPskNwParams());
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    if (!is_1_1(hostapd_)) {
+        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+                                  getIfaceParamsWithAcs(), getPskNwParams());
+        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    }
 }
 
 /**
@@ -148,9 +150,11 @@
  * Access point creation should pass.
  */
 TEST_F(HostapdHidlTest, AddOpenAccessPointWithAcs) {
-    auto status = HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithAcs(),
-                              getOpenNwParams());
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    if (!is_1_1(hostapd_)) {
+        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+                                  getIfaceParamsWithAcs(), getOpenNwParams());
+        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    }
 }
 
 /**
@@ -158,9 +162,11 @@
  * Access point creation should pass.
  */
 TEST_F(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
-    auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
-                              getIfaceParamsWithoutAcs(), getPskNwParams());
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    if (!is_1_1(hostapd_)) {
+        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+                                  getIfaceParamsWithoutAcs(), getPskNwParams());
+        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    }
 }
 
 /**
@@ -168,9 +174,12 @@
  * Access point creation should pass.
  */
 TEST_F(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
-    auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
-                              getIfaceParamsWithoutAcs(), getOpenNwParams());
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    if (!is_1_1(hostapd_)) {
+        auto status =
+            HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
+                        getOpenNwParams());
+        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    }
 }
 
 /**
@@ -178,12 +187,14 @@
  * Access point creation & removal should pass.
  */
 TEST_F(HostapdHidlTest, RemoveAccessPointWithAcs) {
-    auto status = HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithAcs(),
-                              getPskNwParams());
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
-    status =
-        HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    if (!is_1_1(hostapd_)) {
+        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+                                  getIfaceParamsWithAcs(), getPskNwParams());
+        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+        status =
+            HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
+        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    }
 }
 
 /**
@@ -191,12 +202,14 @@
  * Access point creation & removal should pass.
  */
 TEST_F(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
-    auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
-                              getIfaceParamsWithoutAcs(), getPskNwParams());
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
-    status =
-        HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
-    EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    if (!is_1_1(hostapd_)) {
+        auto status = HIDL_INVOKE(hostapd_, addAccessPoint,
+                                  getIfaceParamsWithoutAcs(), getPskNwParams());
+        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+        status =
+            HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
+        EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+    }
 }
 
 /**
@@ -204,10 +217,12 @@
  * Access point creation should fail.
  */
 TEST_F(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
-    auto status =
-        HIDL_INVOKE(hostapd_, addAccessPoint,
-                    getIfaceParamsWithInvalidChannel(), getPskNwParams());
-    EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
+    if (!is_1_1(hostapd_)) {
+        auto status =
+            HIDL_INVOKE(hostapd_, addAccessPoint,
+                        getIfaceParamsWithInvalidChannel(), getPskNwParams());
+        EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
+    }
 }
 
 /**
@@ -215,10 +230,12 @@
  * Access point creation should fail.
  */
 TEST_F(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
-    auto status =
-        HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
-                    getInvalidPskNwParams());
-    EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
+    if (!is_1_1(hostapd_)) {
+        auto status =
+            HIDL_INVOKE(hostapd_, addAccessPoint, getIfaceParamsWithoutAcs(),
+                        getInvalidPskNwParams());
+        EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
+    }
 }
 
 /*
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
index e5ba8ef..22dbb52 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.cpp
@@ -130,6 +130,12 @@
     ASSERT_TRUE(notification_listener->waitForHidlService(200, service_name));
 }
 
+bool is_1_1(const sp<IHostapd>& hostapd) {
+    sp<::android::hardware::wifi::hostapd::V1_1::IHostapd> hostapd_1_1 =
+        ::android::hardware::wifi::hostapd::V1_1::IHostapd::castFrom(hostapd);
+    return hostapd_1_1.get() != nullptr;
+}
+
 sp<IHostapd> getHostapd() {
     return ::testing::VtsHalHidlTargetTestBase::getService<IHostapd>(
         gEnv->getServiceName<IHostapd>());
diff --git a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
index 1b92477..8e2f1a3 100644
--- a/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
+++ b/wifi/hostapd/1.0/vts/functional/hostapd_hidl_test_utils.h
@@ -18,6 +18,7 @@
 #define HOSTAPD_HIDL_TEST_UTILS_H
 
 #include <android/hardware/wifi/hostapd/1.0/IHostapd.h>
+#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
 
 #include <VtsHalHidlTargetTestEnvBase.h>
 
@@ -34,6 +35,8 @@
 // These helper functions should be modified to return vectors if we support
 // multiple instances.
 android::sp<android::hardware::wifi::hostapd::V1_0::IHostapd> getHostapd();
+bool is_1_1(const android::sp<android::hardware::wifi::hostapd::V1_0::IHostapd>&
+                hostapd);
 
 class WifiHostapdHidlEnvironment
     : public ::testing::VtsHalHidlTargetTestEnvBase {
diff --git a/wifi/hostapd/1.1/vts/OWNERS b/wifi/hostapd/1.1/vts/OWNERS
new file mode 100644
index 0000000..8bfb148
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/OWNERS
@@ -0,0 +1,2 @@
+rpius@google.com
+etancohen@google.com
diff --git a/wifi/hostapd/1.1/vts/functional/Android.bp b/wifi/hostapd/1.1/vts/functional/Android.bp
new file mode 100644
index 0000000..bbf5246
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/Android.bp
@@ -0,0 +1,58 @@
+//
+// Copyright (C) 2019 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_library_static {
+    name: "VtsHalWifiHostapdV1_1TargetTestUtil",
+    defaults: ["VtsHalTargetTestDefaults"],
+    srcs: ["hostapd_hidl_test_utils_1_1.cpp"],
+    export_include_dirs: [
+        "."
+    ],
+    static_libs: [
+        "VtsHalWifiV1_0TargetTestUtil",
+        "VtsHalWifiHostapdV1_0TargetTestUtil",
+        "android.hardware.wifi.hostapd@1.0",
+        "android.hardware.wifi.hostapd@1.1",
+        "android.hardware.wifi@1.0",
+        "libcrypto",
+        "libgmock",
+        "libwifi-system",
+        "libwifi-system-iface",
+    ],
+}
+
+cc_test {
+    name: "VtsHalWifiHostapdV1_1TargetTest",
+    defaults: ["VtsHalTargetTestDefaults"],
+    srcs: [
+        "VtsHalWifiHostapdV1_1TargetTest.cpp",
+        "hostapd_hidl_test.cpp",
+    ],
+    static_libs: [
+        "VtsHalWifiV1_0TargetTestUtil",
+        "VtsHalWifiHostapdV1_0TargetTestUtil",
+        "VtsHalWifiHostapdV1_1TargetTestUtil",
+        "android.hardware.wifi.hostapd@1.0",
+        "android.hardware.wifi.hostapd@1.1",
+        "android.hardware.wifi@1.0",
+        "libcrypto",
+        "libgmock",
+        "libwifi-system",
+        "libwifi-system-iface",
+    ],
+    test_suites: ["general-tests"],
+}
+
diff --git a/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp b/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
new file mode 100644
index 0000000..6916db2
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/VtsHalWifiHostapdV1_1TargetTest.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2019 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.0/IWifi.h>
+
+#include "hostapd_hidl_test_utils.h"
+#include "hostapd_hidl_test_utils_1_1.h"
+
+class WifiHostapdHidlEnvironment_1_1 : public WifiHostapdHidlEnvironment {
+   public:
+    // get the test environment singleton
+    static WifiHostapdHidlEnvironment_1_1* Instance() {
+        static WifiHostapdHidlEnvironment_1_1* instance =
+            new WifiHostapdHidlEnvironment_1_1;
+        return instance;
+    }
+
+    virtual void registerTestServices() override {
+        registerTestService<::android::hardware::wifi::V1_0::IWifi>();
+        registerTestService<android::hardware::wifi::hostapd::V1_0::IHostapd>();
+        registerTestService<android::hardware::wifi::hostapd::V1_1::IHostapd>();
+    }
+
+   private:
+    WifiHostapdHidlEnvironment_1_1() {}
+};
+
+WifiHostapdHidlEnvironment* gEnv = WifiHostapdHidlEnvironment_1_1::Instance();
+
+int main(int argc, char** argv) {
+    ::testing::AddGlobalTestEnvironment(gEnv);
+    ::testing::InitGoogleTest(&argc, argv);
+    gEnv->init(&argc, argv);
+    int status = RUN_ALL_TESTS();
+    LOG(INFO) << "Test result = " << status;
+    return status;
+}
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
new file mode 100644
index 0000000..d1af655
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2019 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 <cutils/properties.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
+
+#include "hostapd_hidl_call_util.h"
+#include "hostapd_hidl_test_utils.h"
+#include "hostapd_hidl_test_utils_1_1.h"
+
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::wifi::hostapd::V1_0::HostapdStatus;
+using ::android::hardware::wifi::hostapd::V1_0::HostapdStatusCode;
+using ::android::hardware::wifi::hostapd::V1_1::IHostapd;
+using ::android::hardware::wifi::hostapd::V1_1::IHostapdCallback;
+
+class HostapdHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    virtual void SetUp() override {
+        startHostapdAndWaitForHidlService();
+        hostapd_ = getHostapd_1_1();
+        ASSERT_NE(hostapd_.get(), nullptr);
+    }
+
+    virtual void TearDown() override { stopHostapd(); }
+
+   protected:
+    // IHostapd object used for all tests in this fixture.
+    sp<IHostapd> hostapd_;
+};
+
+class IfaceCallback : public IHostapdCallback {
+    Return<void> onFailure(
+        const hidl_string& /* Name of the interface */) override {
+        return Void();
+    }
+};
+
+/*
+ * RegisterCallback
+ */
+TEST_F(HostapdHidlTest, registerCallback) {
+    hostapd_->registerCallback(
+        new IfaceCallback(), [](const HostapdStatus& status) {
+            EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
+        });
+}
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.cpp b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.cpp
new file mode 100644
index 0000000..8bb72a1
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2019 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 <VtsHalHidlTargetTestBase.h>
+#include <android-base/logging.h>
+
+#include "hostapd_hidl_test_utils.h"
+#include "hostapd_hidl_test_utils_1_1.h"
+
+using ::android::sp;
+using ::android::hardware::wifi::hostapd::V1_1::IHostapd;
+
+sp<IHostapd> getHostapd_1_1() { return IHostapd::castFrom(getHostapd()); }
diff --git a/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.h b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.h
new file mode 100644
index 0000000..c43ddfa
--- /dev/null
+++ b/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test_utils_1_1.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2019 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 HOSTAPD_HIDL_TEST_UTILS_1_1_H
+#define HOSTAPD_HIDL_TEST_UTILS_1_1_H
+
+#include <android/hardware/wifi/hostapd/1.1/IHostapd.h>
+
+#include <VtsHalHidlTargetTestEnvBase.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
+// multiple instances.
+android::sp<android::hardware::wifi::hostapd::V1_1::IHostapd> getHostapd_1_1();
+
+#endif /* HOSTAPD_HIDL_TEST_UTILS_1_1_H */