Skip to content
Snippets Groups Projects
Commit 2665a25c authored by Myles Watson's avatar Myles Watson
Browse files

audio_hal_interface: Remove flag defines

Bug: 307595549
Test: mma -j32
Change-Id: Iceb6f4bce6492468adac4eb603ad4e12e15b67be
parent 782e770b
No related branches found
No related tags found
No related merge requests found
......@@ -40,8 +40,6 @@ static const std::string kDefaultAudioProviderFactoryInterface =
std::unique_ptr<HalVersionManager> HalVersionManager::instance_ptr =
std::make_unique<HalVersionManager>();
#if COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
std::string toString(BluetoothAudioHalTransport transport) {
switch (transport) {
case BluetoothAudioHalTransport::UNKNOWN:
......@@ -104,49 +102,6 @@ BluetoothAudioHalTransport HalVersionManager::GetHalTransport() {
return instance_ptr->hal_version_.getTransport();
}
#else // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
BluetoothAudioHalTransport HalVersionManager::GetHalTransport() {
return instance_ptr->hal_transport_;
}
BluetoothAudioHalVersion GetAidlInterfaceVersion() {
int aidl_version = 0;
auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
::ndk::SpAIBinder(AServiceManager_waitForService(
kDefaultAudioProviderFactoryInterface.c_str())));
if (provider_factory == nullptr) {
LOG_ERROR("Can't get aidl version from unknown factory");
return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
}
auto aidl_retval = provider_factory->getInterfaceVersion(&aidl_version);
if (!aidl_retval.isOk()) {
LOG_ERROR("BluetoothAudioHal::getInterfaceVersion failure: %s",
aidl_retval.getDescription().c_str());
return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
}
switch (aidl_version) {
case 1:
return BluetoothAudioHalVersion::VERSION_AIDL_V1;
case 2:
return BluetoothAudioHalVersion::VERSION_AIDL_V2;
case 3:
return BluetoothAudioHalVersion::VERSION_AIDL_V3;
case 4:
return BluetoothAudioHalVersion::VERSION_AIDL_V4;
default:
LOG_ERROR("Unknown AIDL version %d", aidl_version);
return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
}
return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
}
#endif // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
BluetoothAudioHalVersion HalVersionManager::GetHalVersion() {
std::lock_guard<std::mutex> guard(instance_ptr->mutex_);
return instance_ptr->hal_version_;
......
......@@ -35,7 +35,6 @@ constexpr char kFullyQualifiedInterfaceName_2_0[] =
constexpr char kFullyQualifiedInterfaceName_2_1[] =
"android.hardware.bluetooth.audio@2.1::IBluetoothAudioProvidersFactory";
#if COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
/**
* The type of HAL transport, it's important to have
* BluetoothAudioHalTransport::HIDL value defined smaller than
......@@ -115,27 +114,6 @@ class BluetoothAudioHalVersion {
uint16_t mMinor = 0;
};
#else // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
enum class BluetoothAudioHalVersion : uint8_t {
VERSION_UNAVAILABLE = 0,
VERSION_2_0,
VERSION_2_1,
VERSION_AIDL_V1,
VERSION_AIDL_V2,
VERSION_AIDL_V3,
VERSION_AIDL_V4,
};
enum class BluetoothAudioHalTransport : uint8_t {
// Uninit, default value
UNKNOWN,
AIDL,
HIDL,
};
#endif // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
class HalVersionManager {
public:
static BluetoothAudioHalVersion GetHalVersion();
......
......@@ -19,8 +19,6 @@
namespace bluetooth {
namespace audio {
#if COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
const BluetoothAudioHalVersion BluetoothAudioHalVersion::VERSION_UNAVAILABLE =
BluetoothAudioHalVersion();
const BluetoothAudioHalVersion BluetoothAudioHalVersion::VERSION_2_0 =
......@@ -36,8 +34,6 @@ const BluetoothAudioHalVersion BluetoothAudioHalVersion::VERSION_AIDL_V3 =
const BluetoothAudioHalVersion BluetoothAudioHalVersion::VERSION_AIDL_V4 =
BluetoothAudioHalVersion(BluetoothAudioHalTransport::AIDL, 4, 0);
#endif // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
std::unique_ptr<HalVersionManager> HalVersionManager::instance_ptr = nullptr;
BluetoothAudioHalVersion HalVersionManager::GetHalVersion() {
......
......@@ -147,8 +147,6 @@ TEST_F(BluetoothAudioHalVersionTest, versionOperatorGreaterOrEqual) {
BluetoothAudioHalVersion::VERSION_AIDL_V4);
}
#if COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
TEST_F_WITH_FLAGS(
BluetoothAudioHalVersionTest, HIDL_VERSION_2_0,
REQUIRES_FLAGS_ENABLED(ACONFIG_FLAG(com::android::bluetooth::flags,
......@@ -281,4 +279,3 @@ TEST_F_WITH_FLAGS(
EXPECT_TRUE(BluetoothAudioHalVersion(BluetoothAudioHalTransport::AIDL, 5, 0)
.isAIDL());
}
#endif // #if COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment