Merge "Update measurement interval VTS tests" into udc-dev
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index bb48ecd..515787e 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -114,6 +114,7 @@
         "android/hardware/audio/core/AudioRoute.aidl",
         "android/hardware/audio/core/IBluetooth.aidl",
         "android/hardware/audio/core/IBluetoothA2dp.aidl",
+        "android/hardware/audio/core/IBluetoothLe.aidl",
         "android/hardware/audio/core/IConfig.aidl",
         "android/hardware/audio/core/IModule.aidl",
         "android/hardware/audio/core/IStreamCallback.aidl",
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl
similarity index 86%
rename from graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl
rename to audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl
index 788bd4e..f29e1fd 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl
@@ -1,11 +1,11 @@
-/**
- * Copyright (c) 2023, The Android Open Source Project
+/*
+ * Copyright (C) 2023 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
+ *      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,
@@ -31,8 +31,9 @@
 // with such a backward incompatible change, it has a high risk of breaking
 // later when a module using the interface is updated, e.g., Mainline modules.
 
-package android.hardware.graphics.common;
+package android.hardware.audio.core;
 @VintfStability
-parcelable ParcelableHdr {
-  android.hardware.graphics.common.Hdr hdr;
+interface IBluetoothLe {
+  boolean isEnabled();
+  void setEnabled(boolean enabled);
 }
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
index f18d6a5..e14e9c0 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
@@ -38,6 +38,7 @@
   @nullable android.hardware.audio.core.ITelephony getTelephony();
   @nullable android.hardware.audio.core.IBluetooth getBluetooth();
   @nullable android.hardware.audio.core.IBluetoothA2dp getBluetoothA2dp();
+  @nullable android.hardware.audio.core.IBluetoothLe getBluetoothLe();
   android.media.audio.common.AudioPort connectExternalDevice(in android.media.audio.common.AudioPort templateIdAndAdditionalData);
   void disconnectExternalDevice(int portId);
   android.hardware.audio.core.AudioPatch[] getAudioPatches();
diff --git a/audio/aidl/android/hardware/audio/core/IBluetooth.aidl b/audio/aidl/android/hardware/audio/core/IBluetooth.aidl
index 21ac8e2..7fa2e24 100644
--- a/audio/aidl/android/hardware/audio/core/IBluetooth.aidl
+++ b/audio/aidl/android/hardware/audio/core/IBluetooth.aidl
@@ -25,6 +25,9 @@
  * and the SCO Link. This interface is optional to implement and provide by the
  * vendor. It needs to be provided only if the device actually supports BT SCO
  * or HFP.
+ *
+ * Each of IBluetooth* interfaces is independent of each other. The HAL module
+ * can provide any combination of them.
  */
 @VintfStability
 interface IBluetooth {
diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
index dc4b8d0..c4dd738 100644
--- a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
+++ b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
@@ -24,8 +24,8 @@
  * the vendor. It needs to be provided only if the device actually supports BT
  * A2DP.
  *
- * This interface is separate from IBluetooth interface which manages SCO & HFP.
- * The HAL module can handle both SCO and A2DP profiles or only one of them.
+ * Each of IBluetooth* interfaces is independent of each other. The HAL module
+ * can provide any combination of them.
  */
 @VintfStability
 interface IBluetoothA2dp {
diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl
new file mode 100644
index 0000000..272f862
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2023 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.audio.core;
+
+/**
+ * An instance of IBluetoothLe manages settings for the LE (Low Energy)
+ * profiles. This interface is optional to implement by the vendor. It needs to
+ * be provided only if the device actually supports BT LE.
+ *
+ * Each of IBluetooth* interfaces is independent of each other. The HAL module
+ * can provide any combination of them.
+ */
+@VintfStability
+interface IBluetoothLe {
+    /**
+     * Whether BT LE is enabled.
+     *
+     * Returns the current state of LE support. The client might need to
+     * disable (suspend) LE when another profile (for example, SCO) is
+     * activated.
+     *
+     * @return Whether BT LE is enabled.
+     */
+    boolean isEnabled();
+
+    /**
+     * Enable or disable LE.
+     *
+     * Sets the current state of LE support. The client might need to
+     * disable (suspend) LE when another Bluetooth profile (for example, SCO) is
+     * activated.
+     *
+     * @param enabled Whether BT LE must be enabled or suspended.
+     * @throws EX_ILLEGAL_STATE If there was an error performing the operation.
+     */
+    void setEnabled(boolean enabled);
+}
diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl
index 080d826..7830501 100644
--- a/audio/aidl/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/android/hardware/audio/core/IModule.aidl
@@ -22,6 +22,7 @@
 import android.hardware.audio.core.AudioRoute;
 import android.hardware.audio.core.IBluetooth;
 import android.hardware.audio.core.IBluetoothA2dp;
+import android.hardware.audio.core.IBluetoothLe;
 import android.hardware.audio.core.IStreamCallback;
 import android.hardware.audio.core.IStreamIn;
 import android.hardware.audio.core.IStreamOut;
@@ -118,6 +119,20 @@
     @nullable IBluetoothA2dp getBluetoothA2dp();
 
     /**
+     * Retrieve the interface to control Bluetooth LE.
+     *
+     * If the HAL module supports LE Profile functionality for Bluetooth, it
+     * must return an instance of the IBluetoothLe interface. The same
+     * instance must be returned during the lifetime of the HAL module. If the
+     * HAL module does not support BT LE, a null must be returned, without
+     * throwing any errors.
+     *
+     * @return An instance of the IBluetoothLe interface implementation.
+     * @throws EX_ILLEGAL_STATE If there was an error creating an instance.
+     */
+    @nullable IBluetoothLe getBluetoothLe();
+
+    /**
      * Set a device port of an external device into connected state.
      *
      * This method is used to inform the HAL module that an external device has
@@ -842,7 +857,7 @@
     AudioMMapPolicyInfo[] getMmapPolicyInfos(AudioMMapPolicyType mmapPolicyType);
 
     /**
-     * Indicates if this module supports variable latency control for instance
+     * Indicates if this module supports variable latency control, for instance,
      * over Bluetooth A2DP or LE Audio links.
      *
      * If supported, all instances of IStreamOut interface returned by this module must
diff --git a/audio/aidl/default/Bluetooth.cpp b/audio/aidl/default/Bluetooth.cpp
index bd9a864..8115e7b 100644
--- a/audio/aidl/default/Bluetooth.cpp
+++ b/audio/aidl/default/Bluetooth.cpp
@@ -105,4 +105,16 @@
     return ndk::ScopedAStatus::ok();
 }
 
+ndk::ScopedAStatus BluetoothLe::isEnabled(bool* _aidl_return) {
+    *_aidl_return = mEnabled;
+    LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
+    return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BluetoothLe::setEnabled(bool in_enabled) {
+    mEnabled = in_enabled;
+    LOG(DEBUG) << __func__ << ": " << mEnabled;
+    return ndk::ScopedAStatus::ok();
+}
+
 }  // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index c4f3844..c95c199 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -396,6 +396,15 @@
     return ndk::ScopedAStatus::ok();
 }
 
+ndk::ScopedAStatus Module::getBluetoothLe(std::shared_ptr<IBluetoothLe>* _aidl_return) {
+    if (!mBluetoothLe) {
+        mBluetoothLe = ndk::SharedRefBase::make<BluetoothLe>();
+    }
+    *_aidl_return = mBluetoothLe.getPtr();
+    LOG(DEBUG) << __func__ << ": returning instance of IBluetoothLe: " << _aidl_return->get();
+    return ndk::ScopedAStatus::ok();
+}
+
 ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdAndAdditionalData,
                                                  AudioPort* _aidl_return) {
     const int32_t templateId = in_templateIdAndAdditionalData.id;
diff --git a/audio/aidl/default/include/core-impl/Bluetooth.h b/audio/aidl/default/include/core-impl/Bluetooth.h
index e2f48ba..1cd0355 100644
--- a/audio/aidl/default/include/core-impl/Bluetooth.h
+++ b/audio/aidl/default/include/core-impl/Bluetooth.h
@@ -18,6 +18,7 @@
 
 #include <aidl/android/hardware/audio/core/BnBluetooth.h>
 #include <aidl/android/hardware/audio/core/BnBluetoothA2dp.h>
+#include <aidl/android/hardware/audio/core/BnBluetoothLe.h>
 
 namespace aidl::android::hardware::audio::core {
 
@@ -48,4 +49,15 @@
     bool mEnabled = false;
 };
 
+class BluetoothLe : public BnBluetoothLe {
+  public:
+    BluetoothLe() = default;
+
+  private:
+    ndk::ScopedAStatus isEnabled(bool* _aidl_return) override;
+    ndk::ScopedAStatus setEnabled(bool in_enabled) override;
+
+    bool mEnabled = false;
+};
+
 }  // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h
index 0544646..2cbda7d 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -72,6 +72,7 @@
     ndk::ScopedAStatus getTelephony(std::shared_ptr<ITelephony>* _aidl_return) override;
     ndk::ScopedAStatus getBluetooth(std::shared_ptr<IBluetooth>* _aidl_return) override;
     ndk::ScopedAStatus getBluetoothA2dp(std::shared_ptr<IBluetoothA2dp>* _aidl_return) override;
+    ndk::ScopedAStatus getBluetoothLe(std::shared_ptr<IBluetoothLe>* _aidl_return) override;
     ndk::ScopedAStatus connectExternalDevice(
             const ::aidl::android::media::audio::common::AudioPort& in_templateIdAndAdditionalData,
             ::aidl::android::media::audio::common::AudioPort* _aidl_return) override;
@@ -175,6 +176,7 @@
     ChildInterface<ITelephony> mTelephony;
     ChildInterface<IBluetooth> mBluetooth;
     ChildInterface<IBluetoothA2dp> mBluetoothA2dp;
+    ChildInterface<IBluetoothLe> mBluetoothLe;
     // ids of ports created at runtime via 'connectExternalDevice'.
     std::set<int32_t> mConnectedDevicePorts;
     Streams mStreams;
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index f06c0f1..650a543 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -62,6 +62,7 @@
 using aidl::android::hardware::audio::core::AudioRoute;
 using aidl::android::hardware::audio::core::IBluetooth;
 using aidl::android::hardware::audio::core::IBluetoothA2dp;
+using aidl::android::hardware::audio::core::IBluetoothLe;
 using aidl::android::hardware::audio::core::IModule;
 using aidl::android::hardware::audio::core::IStreamCommon;
 using aidl::android::hardware::audio::core::IStreamIn;
@@ -2111,6 +2112,42 @@
     }
 }
 
+class AudioCoreBluetoothLe : public AudioCoreModuleBase,
+                             public testing::TestWithParam<std::string> {
+  public:
+    void SetUp() override {
+        ASSERT_NO_FATAL_FAILURE(SetUpImpl(GetParam()));
+        ASSERT_IS_OK(module->getBluetoothLe(&bluetooth));
+    }
+
+    void TearDown() override { ASSERT_NO_FATAL_FAILURE(TearDownImpl()); }
+
+    std::shared_ptr<IBluetoothLe> bluetooth;
+};
+
+TEST_P(AudioCoreBluetoothLe, SameInstance) {
+    if (bluetooth == nullptr) {
+        GTEST_SKIP() << "BluetoothLe is not supported";
+    }
+    std::shared_ptr<IBluetoothLe> bluetooth2;
+    EXPECT_IS_OK(module->getBluetoothLe(&bluetooth2));
+    ASSERT_NE(nullptr, bluetooth2.get());
+    EXPECT_EQ(bluetooth->asBinder(), bluetooth2->asBinder())
+            << "getBluetoothLe must return the same interface instance across invocations";
+}
+
+TEST_P(AudioCoreBluetoothLe, Enabled) {
+    if (bluetooth == nullptr) {
+        GTEST_SKIP() << "BluetoothLe is not supported";
+    }
+    // Since enabling LE may require having an actual device connection,
+    // limit testing to setting back the current value.
+    bool enabled;
+    ASSERT_IS_OK(bluetooth->isEnabled(&enabled));
+    EXPECT_IS_OK(bluetooth->setEnabled(enabled))
+            << "setEnabled without actual state change must not fail";
+}
+
 class AudioCoreTelephony : public AudioCoreModuleBase, public testing::TestWithParam<std::string> {
   public:
     void SetUp() override {
@@ -3543,6 +3580,10 @@
                          testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)),
                          android::PrintInstanceNameToString);
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetoothA2dp);
+INSTANTIATE_TEST_SUITE_P(AudioCoreBluetoothLeTest, AudioCoreBluetoothLe,
+                         testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)),
+                         android::PrintInstanceNameToString);
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetoothLe);
 INSTANTIATE_TEST_SUITE_P(AudioCoreTelephonyTest, AudioCoreTelephony,
                          testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)),
                          android::PrintInstanceNameToString);
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl
index 66151ca..b74f7d7 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl
+++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl
@@ -34,7 +34,7 @@
 package android.hardware.graphics.common;
 @VintfStability
 parcelable HdrConversionCapability {
-  android.hardware.graphics.common.ParcelableHdr sourceType;
-  @nullable android.hardware.graphics.common.ParcelableHdr outputType;
+  android.hardware.graphics.common.Hdr sourceType;
+  android.hardware.graphics.common.Hdr outputType;
   boolean addsLatency;
 }
diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
index 6107c4c..c9ba16b 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
@@ -24,7 +24,7 @@
 @Backing(type="int")
 enum Hdr {
     /**
-     *   Invalid HDR type
+     * Invalid HDR type
      */
     INVALID = 0,
     /**
diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl
index 53b3256..d8524a5 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl
@@ -16,22 +16,26 @@
 
 package android.hardware.graphics.common;
 
-import android.hardware.graphics.common.ParcelableHdr;
+import android.hardware.graphics.common.Hdr;
 
 /**
  * Output parameter for IComposerClient.getHdrConversionCapabilities
- *
- * @param sourceType is the HDR type that can be converted to outputType.
- *
- * @param outputType is the HDR type/ SDR that the source type can be converted to. The value null
- * is used to depict SDR outputType.
- *
- * @param addsLatency is false if no latency added due to HDR conversion from sourceType to
- * outputType, otherwise true.
  */
 @VintfStability
 parcelable HdrConversionCapability {
-    ParcelableHdr sourceType;
-    @nullable ParcelableHdr outputType;
+    /** sourceType is the HDR type that can be converted to outputType */
+    Hdr sourceType;
+
+    /**
+     * outputType is the HDR type/ SDR that the source type can be converted to. The value INVALID
+     * is used to depict SDR outputType.
+     */
+
+    Hdr outputType;
+
+    /**
+     * addsLatency is false if no latency added due to HDR conversion from sourceType to
+     * outputType, otherwise true.
+     */
     boolean addsLatency;
 }
diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl
index f564e9f..71beaa0 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl
@@ -15,25 +15,32 @@
  */
 
 package android.hardware.graphics.common;
+
+import android.hardware.graphics.common.Hdr;
 /**
  * Input parameter for IComposerClient.setHdrConversionStrategy
- *
- * @param passthrough - When this parameter is set to true, HDR conversion is disabled by the
- * implementation. The output HDR type will change dynamically to match the content. This value is
- * never set to false, as other union values will be present in the false case.
- *
- * @param autoAllowedHdrTypes - When this parameter is set, the output HDR type is selected by the
- * implementation. The implementation is only allowed to set the output HDR type to the HDR types
- * present in this list. If conversion to any of the autoHdrTypes types is not possible, the
- * implementation should do no conversion.
- *
- * @param forceHdrConversion - When this parameter is set, the implementation should convert all
- * content to this HDR type, when possible. If not possible, the functionality should be similar to
- * passthrough=true.
  */
 @VintfStability
 union HdrConversionStrategy {
+    /**
+     * When this parameter is set to true, HDR conversion is disabled by the
+     * implementation. The output HDR type will change dynamically to match the content. This value
+     * is never set to false, as other union values will be present in the false case.
+     */
     boolean passthrough = true;
-    android.hardware.graphics.common.Hdr[] autoAllowedHdrTypes;
-    android.hardware.graphics.common.Hdr forceHdrConversion;
+
+    /**
+     * When this parameter is set, the output HDR type is selected by the
+     * implementation. The implementation is only allowed to set the output HDR type to the HDR
+     * types present in this list. If conversion to any of the autoHdrTypes types is not possible,
+     * the implementation should do no conversion.
+     */
+    Hdr[] autoAllowedHdrTypes;
+
+    /**
+     * When this parameter is set, the implementation should convert all
+     * content to this HDR type, when possible. If not possible, the functionality should be similar
+     * to passthrough=true.
+     */
+    Hdr forceHdrConversion;
 }
diff --git a/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl
deleted file mode 100644
index 9aff277..0000000
--- a/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * Copyright (c) 2023, 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.graphics.common;
-
-import android.hardware.graphics.common.Hdr;
-
-@VintfStability
-parcelable ParcelableHdr {
-    Hdr hdr;
-}
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 1ecd405..746330b 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -650,10 +650,10 @@
     }
     const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities();
     for (auto conversionCapability : conversionCapabilities) {
-        if (conversionCapability.outputType) {
+        if (conversionCapability.outputType != common::Hdr::INVALID) {
             common::HdrConversionStrategy hdrConversionStrategy;
             hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::forceHdrConversion>(
-                    conversionCapability.outputType->hdr);
+                    conversionCapability.outputType);
             const auto& [statusSet, preferredHdrOutputType] =
                     mComposerClient->setHdrConversionStrategy(hdrConversionStrategy);
             EXPECT_TRUE(statusSet.isOk());
@@ -670,8 +670,8 @@
     const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities();
     std::vector<aidl::android::hardware::graphics::common::Hdr> autoHdrTypes;
     for (auto conversionCapability : conversionCapabilities) {
-        if (conversionCapability.outputType) {
-            autoHdrTypes.push_back(conversionCapability.outputType->hdr);
+        if (conversionCapability.outputType != common::Hdr::INVALID) {
+            autoHdrTypes.push_back(conversionCapability.outputType);
         }
     }
     common::HdrConversionStrategy hdrConversionStrategy;
diff --git a/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp b/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp
index 7bcc6d3..37c55e7 100644
--- a/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp
+++ b/wifi/1.6/vts/functional/wifi_nan_iface_hidl_test.cpp
@@ -68,17 +68,10 @@
 
     virtual void TearDown() override { stopWifi(GetInstanceName()); }
 
-    /* Used as a mechanism to inform the test about data/event callback */
-    inline void notify() {
-        std::unique_lock<std::mutex> lock(mtx_);
-        count_++;
-        cv_.notify_one();
-    }
 
     enum CallbackType {
-        INVALID = -2,
         ANY_CALLBACK = -1,
-
+        INVALID = 0,
         NOTIFY_CAPABILITIES_RESPONSE = 0,
         NOTIFY_ENABLE_RESPONSE,
         NOTIFY_CONFIG_RESPONSE,
@@ -114,8 +107,14 @@
         EVENT_DATA_PATH_CONFIRM_1_6,
     };
 
+    /* Used as a mechanism to inform the test about data/event callback */
+    inline void notify(CallbackType callbackType) {
+        std::unique_lock<std::mutex> lock(mtx_);
+        callbackEventBitMap |= (0x1 << callbackType);
+        cv_.notify_one();
+    }
     /* Test code calls this function to wait for data/event callback */
-    /* Must set callbackType = INVALID before call this function */
+    /* Must set callbackEventBitMap = INVALID before call this function */
     inline std::cv_status wait(CallbackType waitForCallbackType) {
         std::unique_lock<std::mutex> lock(mtx_);
 
@@ -124,15 +123,11 @@
 
         std::cv_status status = std::cv_status::no_timeout;
         auto now = std::chrono::system_clock::now();
-        while (count_ == 0) {
+        while (!(callbackEventBitMap & (0x1 << waitForCallbackType))) {
             status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
-            if (status == std::cv_status::timeout) return status;
-            if (waitForCallbackType != ANY_CALLBACK && callbackType != INVALID &&
-                callbackType != waitForCallbackType) {
-                count_--;
-            }
+            if (status == std::cv_status::timeout)
+                return status;
         }
-        count_--;
         return status;
     }
 
@@ -148,340 +143,276 @@
         Return<void> notifyCapabilitiesResponse(
                 uint16_t id, const WifiNanStatus& status,
                 const ::android::hardware::wifi::V1_0::NanCapabilities& capabilities) override {
-            parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
             parent_.capabilities = capabilities;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_CAPABILITIES_RESPONSE);
             return Void();
         }
 
         Return<void> notifyCapabilitiesResponse_1_5(
                 uint16_t id, const WifiNanStatus& status,
                 const ::android::hardware::wifi::V1_5::NanCapabilities& capabilities) override {
-            parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE_1_5;
-
             parent_.id = id;
             parent_.status = status;
             parent_.capabilities_1_5 = capabilities;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_CAPABILITIES_RESPONSE_1_5);
             return Void();
         }
 
         Return<void> notifyEnableResponse(uint16_t id, const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_ENABLE_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_ENABLE_RESPONSE);
             return Void();
         }
 
         Return<void> notifyConfigResponse(uint16_t id, const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_CONFIG_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_CONFIG_RESPONSE);
             return Void();
         }
 
         Return<void> notifyDisableResponse(uint16_t id, const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_DISABLE_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_DISABLE_RESPONSE);
             return Void();
         }
 
         Return<void> notifyStartPublishResponse(uint16_t id, const WifiNanStatus& status,
                                                 uint8_t sessionId) override {
-            parent_.callbackType = NOTIFY_START_PUBLISH_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
             parent_.sessionId = sessionId;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_START_PUBLISH_RESPONSE);
             return Void();
         }
 
         Return<void> notifyStopPublishResponse(uint16_t id, const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_STOP_PUBLISH_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_STOP_PUBLISH_RESPONSE);
             return Void();
         }
 
         Return<void> notifyStartSubscribeResponse(uint16_t id, const WifiNanStatus& status,
                                                   uint8_t sessionId) override {
-            parent_.callbackType = NOTIFY_START_SUBSCRIBE_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
             parent_.sessionId = sessionId;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_START_SUBSCRIBE_RESPONSE);
             return Void();
         }
 
         Return<void> notifyStopSubscribeResponse(uint16_t id,
                                                  const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_STOP_SUBSCRIBE_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_STOP_SUBSCRIBE_RESPONSE);
             return Void();
         }
 
         Return<void> notifyTransmitFollowupResponse(uint16_t id,
                                                     const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE);
             return Void();
         }
 
         Return<void> notifyCreateDataInterfaceResponse(uint16_t id,
                                                        const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_CREATE_DATA_INTERFACE_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_CREATE_DATA_INTERFACE_RESPONSE);
             return Void();
         }
 
         Return<void> notifyDeleteDataInterfaceResponse(uint16_t id,
                                                        const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_DELETE_DATA_INTERFACE_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_DELETE_DATA_INTERFACE_RESPONSE);
             return Void();
         }
 
         Return<void> notifyInitiateDataPathResponse(uint16_t id, const WifiNanStatus& status,
                                                     uint32_t ndpInstanceId) override {
-            parent_.callbackType = NOTIFY_INITIATE_DATA_PATH_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
             parent_.ndpInstanceId = ndpInstanceId;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_INITIATE_DATA_PATH_RESPONSE);
             return Void();
         }
 
         Return<void> notifyRespondToDataPathIndicationResponse(
                 uint16_t id, const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE);
             return Void();
         }
 
         Return<void> notifyTerminateDataPathResponse(uint16_t id,
                                                      const WifiNanStatus& status) override {
-            parent_.callbackType = NOTIFY_TERMINATE_DATA_PATH_RESPONSE;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_TERMINATE_DATA_PATH_RESPONSE);
             return Void();
         }
 
         Return<void> eventClusterEvent(const NanClusterEventInd& event) override {
-            parent_.callbackType = EVENT_CLUSTER_EVENT;
-
             parent_.nanClusterEventInd = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_CLUSTER_EVENT);
             return Void();
         }
 
         Return<void> eventDisabled(const WifiNanStatus& status) override {
-            parent_.callbackType = EVENT_DISABLED;
-
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(EVENT_DISABLED);
             return Void();
         }
 
         Return<void> eventPublishTerminated(uint8_t sessionId,
                                             const WifiNanStatus& status) override {
-            parent_.callbackType = EVENT_PUBLISH_TERMINATED;
-
             parent_.sessionId = sessionId;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(EVENT_PUBLISH_TERMINATED);
             return Void();
         }
 
         Return<void> eventSubscribeTerminated(uint8_t sessionId,
                                               const WifiNanStatus& status) override {
-            parent_.callbackType = EVENT_SUBSCRIBE_TERMINATED;
-
             parent_.sessionId = sessionId;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(EVENT_SUBSCRIBE_TERMINATED);
             return Void();
         }
 
         Return<void> eventMatch(
                 const ::android::hardware::wifi::V1_0::NanMatchInd& event) override {
-            parent_.callbackType = EVENT_MATCH;
-
             parent_.nanMatchInd = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_MATCH);
             return Void();
         }
 
         Return<void> eventMatchExpired(uint8_t discoverySessionId, uint32_t peerId) override {
-            parent_.callbackType = EVENT_MATCH_EXPIRED;
-
             parent_.sessionId = discoverySessionId;
             parent_.peerId = peerId;
 
-            parent_.notify();
+            parent_.notify(EVENT_MATCH_EXPIRED);
             return Void();
         }
 
         Return<void> eventFollowupReceived(const NanFollowupReceivedInd& event) override {
-            parent_.callbackType = EVENT_FOLLOWUP_RECEIVED;
-
             parent_.nanFollowupReceivedInd = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_FOLLOWUP_RECEIVED);
             return Void();
         }
 
         Return<void> eventTransmitFollowup(uint16_t id, const WifiNanStatus& status) override {
-            parent_.callbackType = EVENT_TRANSMIT_FOLLOWUP;
-
             parent_.id = id;
             parent_.status = status;
 
-            parent_.notify();
+            parent_.notify(EVENT_TRANSMIT_FOLLOWUP);
             return Void();
         }
 
         Return<void> eventDataPathRequest(const NanDataPathRequestInd& event) override {
-            parent_.callbackType = EVENT_DATA_PATH_REQUEST;
-
             parent_.nanDataPathRequestInd = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_DATA_PATH_REQUEST);
             return Void();
         }
 
         Return<void> eventDataPathConfirm(
                 const ::android::hardware::wifi::V1_0::NanDataPathConfirmInd& event) override {
-            parent_.callbackType = EVENT_DATA_PATH_CONFIRM;
-
             parent_.nanDataPathConfirmInd = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_DATA_PATH_CONFIRM);
             return Void();
         }
 
         Return<void> eventDataPathTerminated(uint32_t ndpInstanceId) override {
-            parent_.callbackType = EVENT_DATA_PATH_TERMINATED;
-
             parent_.ndpInstanceId = ndpInstanceId;
 
-            parent_.notify();
+            parent_.notify(EVENT_DATA_PATH_TERMINATED);
             return Void();
         }
 
         Return<void> eventDataPathConfirm_1_2(
                 const ::android::hardware::wifi::V1_2::NanDataPathConfirmInd& event) override {
-            parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_2;
-
             parent_.nanDataPathConfirmInd_1_2 = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_DATA_PATH_CONFIRM_1_2);
             return Void();
         }
 
         Return<void> eventDataPathScheduleUpdate(
                 const ::android::hardware::wifi::V1_2::NanDataPathScheduleUpdateInd& event)
                 override {
-            parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE;
-
             parent_.nanDataPathScheduleUpdateInd_1_2 = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_DATA_PATH_SCHEDULE_UPDATE);
             return Void();
         }
 
         Return<void> eventMatch_1_6(
                 const ::android::hardware::wifi::V1_6::NanMatchInd& event) override {
-            parent_.callbackType = EVENT_MATCH_1_6;
-
             parent_.nanMatchInd_1_6 = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_MATCH_1_6);
             return Void();
         }
 
         Return<void> notifyCapabilitiesResponse_1_6(
                 uint16_t id, const WifiNanStatus& status,
                 const ::android::hardware::wifi::V1_6::NanCapabilities& capabilities) override {
-            parent_.callbackType = NOTIFY_CAPABILITIES_RESPONSE_1_6;
-
             parent_.id = id;
             parent_.status = status;
             parent_.capabilities_1_6 = capabilities;
 
-            parent_.notify();
+            parent_.notify(NOTIFY_CAPABILITIES_RESPONSE_1_6);
             return Void();
         }
 
         Return<void> eventDataPathScheduleUpdate_1_6(
                 const ::android::hardware::wifi::V1_6::NanDataPathScheduleUpdateInd& event)
                 override {
-            parent_.callbackType = EVENT_DATA_PATH_SCHEDULE_UPDATE_1_6;
-
             parent_.nanDataPathScheduleUpdateInd_1_6 = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_DATA_PATH_SCHEDULE_UPDATE_1_6);
             return Void();
         }
 
         Return<void> eventDataPathConfirm_1_6(
                 const ::android::hardware::wifi::V1_6::NanDataPathConfirmInd& event) override {
-            parent_.callbackType = EVENT_DATA_PATH_CONFIRM_1_6;
-
             parent_.nanDataPathConfirmInd_1_6 = event;
 
-            parent_.notify();
+            parent_.notify(EVENT_DATA_PATH_CONFIRM_1_6);
             return Void();
         }
     };
@@ -490,7 +421,6 @@
     // synchronization objects
     std::mutex mtx_;
     std::condition_variable cv_;
-    int count_ = 0;
 
   protected:
     android::sp<::android::hardware::wifi::V1_6::IWifiNanIface> iwifiNanIface;
@@ -498,7 +428,7 @@
     // Data from IWifiNanIfaceEventCallback callbacks: this is the collection of
     // all arguments to all callbacks. They are set by the callback
     // (notifications or events) and can be retrieved by tests.
-    CallbackType callbackType;
+    uint32_t callbackEventBitMap;
     uint16_t id;
     WifiNanStatus status;
     uint8_t sessionId;
@@ -535,7 +465,7 @@
  */
 TEST_P(WifiNanIfaceHidlTest, enableRequest_1_6InvalidArgs) {
     uint16_t inputCmdId = 10;
-    callbackType = INVALID;
+    callbackEventBitMap = INVALID;
     ::android::hardware::wifi::V1_4::NanEnableRequest nanEnableRequest = {};
     ::android::hardware::wifi::V1_6::NanConfigRequestSupplemental nanConfigRequestSupp = {};
     const auto& halStatus = HIDL_INVOKE(iwifiNanIface, enableRequest_1_6, inputCmdId,
@@ -545,7 +475,7 @@
 
         // wait for a callback
         ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE));
-        ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType);
+        ASSERT_EQ(0x1 << NOTIFY_ENABLE_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_ENABLE_RESPONSE));
         ASSERT_EQ(id, inputCmdId);
         ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS);
     }
@@ -572,7 +502,7 @@
  */
 TEST_P(WifiNanIfaceHidlTest, configRequest_1_6InvalidArgs) {
     uint16_t inputCmdId = 10;
-    callbackType = INVALID;
+    callbackEventBitMap = INVALID;
     ::android::hardware::wifi::V1_4::NanConfigRequest nanConfigRequest = {};
     ::android::hardware::wifi::V1_6::NanConfigRequestSupplemental nanConfigRequestSupp = {};
     const auto& halStatus = HIDL_INVOKE(iwifiNanIface, configRequest_1_6, inputCmdId,
@@ -583,7 +513,7 @@
 
         // wait for a callback
         ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CONFIG_RESPONSE));
-        ASSERT_EQ(NOTIFY_CONFIG_RESPONSE, callbackType);
+        ASSERT_EQ(0x1 << NOTIFY_CONFIG_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_CONFIG_RESPONSE));
         ASSERT_EQ(id, inputCmdId);
         ASSERT_EQ(status.status, NanStatusType::INVALID_ARGS);
     }
@@ -610,12 +540,12 @@
  */
 TEST_P(WifiNanIfaceHidlTest, notifyCapabilitiesResponse_1_6) {
     uint16_t inputCmdId = 10;
-    callbackType = INVALID;
+    callbackEventBitMap = INVALID;
     const auto& halStatus = HIDL_INVOKE(iwifiNanIface, getCapabilitiesRequest_1_5, inputCmdId).code;
     ASSERT_EQ(WifiStatusCode::SUCCESS, halStatus);
     // wait for a callback
     ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CAPABILITIES_RESPONSE_1_6));
-    ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE_1_6, callbackType);
+    ASSERT_EQ(0x1 << NOTIFY_CAPABILITIES_RESPONSE_1_6, callbackEventBitMap & (0x1 << NOTIFY_CAPABILITIES_RESPONSE_1_6));
     ASSERT_EQ(id, inputCmdId);
     ASSERT_EQ(status.status, NanStatusType::SUCCESS);
 
@@ -711,7 +641,7 @@
     nanConfigRequestSupp.V1_5.V1_2.numberOfSpatialStreamsInDiscovery = 0;
     nanConfigRequestSupp.V1_5.V1_2.enableDiscoveryWindowEarlyTermination = false;
 
-    callbackType = INVALID;
+    callbackEventBitMap = INVALID;
 
     const auto& halStatus =
             HIDL_INVOKE(iwifiNanIface, enableRequest_1_6, inputCmdId, req, nanConfigRequestSupp);
@@ -720,7 +650,7 @@
 
         // wait for a callback
         ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE));
-        ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callbackType);
+        ASSERT_EQ(0x1 << NOTIFY_ENABLE_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_ENABLE_RESPONSE));
         ASSERT_EQ(id, inputCmdId);
         ASSERT_EQ(status.status, NanStatusType::SUCCESS);
     }
@@ -749,7 +679,7 @@
 
         // wait for a callback
         ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_START_PUBLISH_RESPONSE));
-        ASSERT_EQ(NOTIFY_START_PUBLISH_RESPONSE, callbackType);
+        ASSERT_EQ(0x1 << NOTIFY_START_PUBLISH_RESPONSE, callbackEventBitMap & (0x1 << NOTIFY_START_PUBLISH_RESPONSE));
         ASSERT_EQ(id, inputCmdId + 1);
         ASSERT_EQ(status.status, NanStatusType::SUCCESS);
     }
@@ -760,7 +690,7 @@
  */
 TEST_P(WifiNanIfaceHidlTest, respondToDataPathIndicationRequest_1_6ShimInvalidArgs) {
     uint16_t inputCmdId = 10;
-    callbackType = INVALID;
+    callbackEventBitMap = INVALID;
     ::android::hardware::wifi::V1_6::NanRespondToDataPathIndicationRequest
             nanRespondToDataPathIndicationRequest = {};
     nanRespondToDataPathIndicationRequest.ifaceName = "AwareinterfaceNameTooLong";
@@ -777,7 +707,7 @@
  */
 TEST_P(WifiNanIfaceHidlTest, initiateDataPathRequest_1_6ShimInvalidArgs) {
     uint16_t inputCmdId = 10;
-    callbackType = INVALID;
+    callbackEventBitMap = INVALID;
     ::android::hardware::wifi::V1_6::NanInitiateDataPathRequest nanInitiateDataPathRequest = {};
     nanInitiateDataPathRequest.ifaceName = "AwareinterfaceNameTooLong";
     const auto& halStatus = HIDL_INVOKE(iwifiNanIface, initiateDataPathRequest_1_6, inputCmdId,