diff --git a/audio/common/2.0/default/Android.bp b/audio/common/2.0/default/Android.bp deleted file mode 100644 index ac66479c93..0000000000 --- a/audio/common/2.0/default/Android.bp +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright (C) 2016 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -cc_library_shared { - name: "android.hardware.audio.common@2.0-util", - defaults: ["hidl_defaults"], - vendor_available: true, - vndk: { - enabled: true, - }, - srcs: [ - "HidlUtils.cpp", - ], - - export_include_dirs: ["."], - - static_libs: [ - ], - - shared_libs: [ - "liblog", - "libutils", - "libhidlbase", - "android.hardware.audio.common-util", - "android.hardware.audio.common@2.0", - ], - export_shared_lib_headers: [ - "android.hardware.audio.common-util" - ], - - header_libs: [ - "libaudio_system_headers", - "libhardware_headers", - ], -} diff --git a/audio/common/2.0/default/HidlUtils.cpp b/audio/common/2.0/default/HidlUtils.cpp deleted file mode 100644 index 9771b7bda2..0000000000 --- a/audio/common/2.0/default/HidlUtils.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "HidlUtils.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/common/2.0/default/HidlUtils.h b/audio/common/2.0/default/HidlUtils.h deleted file mode 100644 index 24543b1617..0000000000 --- a/audio/common/2.0/default/HidlUtils.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef android_hardware_audio_V2_0_Hidl_Utils_H_ -#define android_hardware_audio_V2_0_Hidl_Utils_H_ - -#include - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // android_hardware_audio_V2_0_Hidl_Utils_H_ diff --git a/audio/common/2.0/default/VersionUtils.h b/audio/common/2.0/default/VersionUtils.h deleted file mode 100644 index 60d1f9cb6d..0000000000 --- a/audio/common/2.0/default/VersionUtils.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H - -#include - -namespace android { -namespace hardware { -namespace audio { -namespace common { -namespace V2_0 { -namespace implementation { - -typedef common::V2_0::AudioDevice AudioDeviceBitfield; -typedef common::V2_0::AudioChannelMask AudioChannelBitfield; -typedef common::V2_0::AudioOutputFlag AudioOutputFlagBitfield; -typedef common::V2_0::AudioInputFlag AudioInputFlagBitfield; - -} // namespace implementation -} // namespace V2_0 -} // namespace common -} // namespace audio -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H diff --git a/audio/common/4.0/default/Android.bp b/audio/common/4.0/default/Android.bp deleted file mode 100644 index 57b2e01f3d..0000000000 --- a/audio/common/4.0/default/Android.bp +++ /dev/null @@ -1,47 +0,0 @@ -// -// Copyright (C) 2018 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_shared { - name: "android.hardware.audio.common@4.0-util", - defaults: ["hidl_defaults"], - vendor_available: true, - vndk: { - enabled: true, - }, - srcs: [ - "HidlUtils.cpp", - ], - - export_include_dirs: ["."], - - static_libs: [ - ], - - shared_libs: [ - "liblog", - "libutils", - "libhidlbase", - "android.hardware.audio.common-util", - "android.hardware.audio.common@4.0", - ], - export_shared_lib_headers: [ - "android.hardware.audio.common-util" - ], - - header_libs: [ - "libaudio_system_headers", - "libhardware_headers", - ], -} diff --git a/audio/common/4.0/default/HidlUtils.cpp b/audio/common/4.0/default/HidlUtils.cpp deleted file mode 100644 index b66eff975a..0000000000 --- a/audio/common/4.0/default/HidlUtils.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2018 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 "HidlUtils.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/common/4.0/default/HidlUtils.h b/audio/common/4.0/default/HidlUtils.h deleted file mode 100644 index 91e6a9e121..0000000000 --- a/audio/common/4.0/default/HidlUtils.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef android_hardware_audio_V4_0_Hidl_Utils_H_ -#define android_hardware_audio_V4_0_Hidl_Utils_H_ - -#include - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // android_hardware_audio_V4_0_Hidl_Utils_H_ diff --git a/audio/common/all-versions/default/Android.bp b/audio/common/all-versions/default/Android.bp index c24f4b0c58..6b09d546b3 100644 --- a/audio/common/all-versions/default/Android.bp +++ b/audio/common/all-versions/default/Android.bp @@ -38,3 +38,73 @@ cc_library_shared { "android.hardware.audio.common.util@all-versions", ] } + +cc_library_shared { + name: "android.hardware.audio.common@2.0-util", + defaults: ["hidl_defaults"], + vendor_available: true, + srcs: [ + "HidlUtils.cpp", + ], + + export_include_dirs: ["."], + + static_libs: [ + ], + + shared_libs: [ + "liblog", + "libutils", + "libhidlbase", + "android.hardware.audio.common-util", + "android.hardware.audio.common@2.0", + ], + export_shared_lib_headers: [ + "android.hardware.audio.common-util" + ], + + header_libs: [ + "libaudio_system_headers", + "libhardware_headers", + ], + cflags: [ + "-DMAJOR_VERSION=2", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] +} + +cc_library_shared { + name: "android.hardware.audio.common@4.0-util", + defaults: ["hidl_defaults"], + vendor_available: true, + srcs: [ + "HidlUtils.cpp", + ], + + export_include_dirs: ["."], + + static_libs: [ + ], + + shared_libs: [ + "liblog", + "libutils", + "libhidlbase", + "android.hardware.audio.common-util", + "android.hardware.audio.common@4.0", + ], + export_shared_lib_headers: [ + "android.hardware.audio.common-util" + ], + + header_libs: [ + "libaudio_system_headers", + "libhardware_headers", + ], + cflags: [ + "-DMAJOR_VERSION=4", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] +} diff --git a/audio/common/all-versions/default/EffectMap.cpp b/audio/common/all-versions/default/EffectMap.cpp index 7f8da1e2ab..cb3e3d59d7 100644 --- a/audio/common/all-versions/default/EffectMap.cpp +++ b/audio/common/all-versions/default/EffectMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. diff --git a/audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.impl.h b/audio/common/all-versions/default/HidlUtils.cpp similarity index 93% rename from audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.impl.h rename to audio/common/all-versions/default/HidlUtils.cpp index 03b50b54df..5ed059c5a7 100644 --- a/audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.impl.h +++ b/audio/common/all-versions/default/HidlUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,24 +14,22 @@ * limitations under the License. */ -#ifndef AUDIO_HAL_VERSION -#error "AUDIO_HAL_VERSION must be set before including this file." -#endif +#include "HidlUtils.h" #include #include -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGainMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMixLatencyClass; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfigMask; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortRole; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortType; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioStreamType; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioUsage; +using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioFormat; +using ::android::hardware::audio::common::CPP_VERSION::AudioGainMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioMixLatencyClass; +using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfigMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioPortRole; +using ::android::hardware::audio::common::CPP_VERSION::AudioPortType; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::common::CPP_VERSION::AudioStreamType; +using ::android::hardware::audio::common::CPP_VERSION::AudioUsage; using ::android::hardware::audio::common::utils::EnumBitfield; @@ -39,7 +37,7 @@ namespace android { namespace hardware { namespace audio { namespace common { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { void HidlUtils::audioConfigFromHal(const audio_config_t& halConfig, AudioConfig* config) { config->sampleRateHz = halConfig.sample_rate; @@ -358,7 +356,7 @@ void HidlUtils::uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid) { memcpy(halUuid->node, uuid.node.data(), uuid.node.size()); } -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace common } // namespace audio } // namespace hardware diff --git a/audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.h b/audio/common/all-versions/default/HidlUtils.h similarity index 78% rename from audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.h rename to audio/common/all-versions/default/HidlUtils.h index 48fa5450ea..77c8b89e1a 100644 --- a/audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.h +++ b/audio/common/all-versions/default/HidlUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,28 +14,29 @@ * limitations under the License. */ -#ifndef AUDIO_HAL_VERSION -#error "AUDIO_HAL_VERSION must be set before including this file." -#endif +#ifndef android_hardware_audio_Hidl_Utils_H_ +#define android_hardware_audio_Hidl_Utils_H_ + +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) #include #include using ::android::hardware::hidl_vec; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGain; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGainConfig; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOffloadInfo; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid; +using ::android::hardware::audio::common::CPP_VERSION::AudioConfig; +using ::android::hardware::audio::common::CPP_VERSION::AudioGain; +using ::android::hardware::audio::common::CPP_VERSION::AudioGainConfig; +using ::android::hardware::audio::common::CPP_VERSION::AudioOffloadInfo; +using ::android::hardware::audio::common::CPP_VERSION::AudioPort; +using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfig; +using ::android::hardware::audio::common::CPP_VERSION::Uuid; namespace android { namespace hardware { namespace audio { namespace common { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { class HidlUtils { public: @@ -68,8 +69,10 @@ class HidlUtils { static void uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid); }; -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace common } // namespace audio } // namespace hardware } // namespace android + +#endif // android_hardware_audio_Hidl_Utils_H_ diff --git a/audio/common/2.0/default/OWNERS b/audio/common/all-versions/default/OWNERS similarity index 100% rename from audio/common/2.0/default/OWNERS rename to audio/common/all-versions/default/OWNERS diff --git a/audio/common/4.0/default/VersionUtils.h b/audio/common/all-versions/default/VersionUtils.h similarity index 57% rename from audio/common/4.0/default/VersionUtils.h rename to audio/common/all-versions/default/VersionUtils.h index b7f2aec8f9..4726b5b9a9 100644 --- a/audio/common/4.0/default/VersionUtils.h +++ b/audio/common/all-versions/default/VersionUtils.h @@ -17,22 +17,29 @@ #ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H #define ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H -#include +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) namespace android { namespace hardware { namespace audio { namespace common { -namespace V4_0 { +namespace CPP_VERSION { namespace implementation { -typedef hidl_bitfield AudioDeviceBitfield; -typedef hidl_bitfield AudioChannelBitfield; -typedef hidl_bitfield AudioOutputFlagBitfield; -typedef hidl_bitfield AudioInputFlagBitfield; +#if MAJOR_VERSION == 2 +typedef common::CPP_VERSION::AudioDevice AudioDeviceBitfield; +typedef common::CPP_VERSION::AudioChannelMask AudioChannelBitfield; +typedef common::CPP_VERSION::AudioOutputFlag AudioOutputFlagBitfield; +typedef common::CPP_VERSION::AudioInputFlag AudioInputFlagBitfield; +#elif MAJOR_VERSION == 4 +typedef hidl_bitfield AudioDeviceBitfield; +typedef hidl_bitfield AudioChannelBitfield; +typedef hidl_bitfield AudioOutputFlagBitfield; +typedef hidl_bitfield AudioInputFlagBitfield; +#endif } // namespace implementation -} // namespace V4_0 +} // namespace CPP_VERSION } // namespace common } // namespace audio } // namespace hardware diff --git a/audio/common/all-versions/default/include/common/all-versions/default/EffectMap.h b/audio/common/all-versions/default/include/common/all-versions/default/EffectMap.h index 547c6d5a9f..7f630bf09e 100644 --- a/audio/common/all-versions/default/include/common/all-versions/default/EffectMap.h +++ b/audio/common/all-versions/default/include/common/all-versions/default/EffectMap.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. diff --git a/audio/common/all-versions/test/utility/include/utility/AssertOk.h b/audio/common/all-versions/test/utility/include/utility/AssertOk.h index 11e1c24783..5ac2fdc936 100644 --- a/audio/common/all-versions/test/utility/include/utility/AssertOk.h +++ b/audio/common/all-versions/test/utility/include/utility/AssertOk.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. diff --git a/audio/common/all-versions/test/utility/include/utility/Documentation.h b/audio/common/all-versions/test/utility/include/utility/Documentation.h index e10cf79ecc..1b555b996a 100644 --- a/audio/common/all-versions/test/utility/include/utility/Documentation.h +++ b/audio/common/all-versions/test/utility/include/utility/Documentation.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. diff --git a/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h b/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h index 7a08a54fc8..0e416f3c64 100644 --- a/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h +++ b/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. diff --git a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h index abc2ff5f82..3833fd072e 100644 --- a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h +++ b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,10 +14,6 @@ * limitations under the License. */ -#ifndef AUDIO_HAL_VERSION -#error "AUDIO_HAL_VERSION must be set before including this file." -#endif - #ifndef ANDROID_HARDWARE_AUDIO_COMMON_TEST_UTILITY_PRETTY_PRINT_AUDIO_TYPES_H #define ANDROID_HARDWARE_AUDIO_COMMON_TEST_UTILITY_PRETTY_PRINT_AUDIO_TYPES_H @@ -40,19 +36,19 @@ namespace audio { #define DEFINE_GTEST_PRINT_TO(T) \ inline void PrintTo(const T& val, ::std::ostream* os) { *os << toString(val); } -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { DEFINE_GTEST_PRINT_TO(IPrimaryDevice::TtyMode) DEFINE_GTEST_PRINT_TO(Result) -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION namespace common { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { DEFINE_GTEST_PRINT_TO(AudioConfig) DEFINE_GTEST_PRINT_TO(AudioMode) DEFINE_GTEST_PRINT_TO(AudioDevice) DEFINE_GTEST_PRINT_TO(AudioFormat) DEFINE_GTEST_PRINT_TO(AudioChannelMask) -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace common #undef DEFINE_GTEST_PRINT_TO diff --git a/audio/common/all-versions/test/utility/include/utility/ReturnIn.h b/audio/common/all-versions/test/utility/include/utility/ReturnIn.h index 7fd0d4a437..de16809380 100644 --- a/audio/common/all-versions/test/utility/include/utility/ReturnIn.h +++ b/audio/common/all-versions/test/utility/include/utility/ReturnIn.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. diff --git a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h index 91adfc12c8..ee206f7458 100644 --- a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h +++ b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. diff --git a/audio/common/all-versions/test/utility/src/ValidateXml.cpp b/audio/common/all-versions/test/utility/src/ValidateXml.cpp index 1a906d668b..e54914d82d 100644 --- a/audio/common/all-versions/test/utility/src/ValidateXml.cpp +++ b/audio/common/all-versions/test/utility/src/ValidateXml.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. diff --git a/audio/common/all-versions/util/include/common/all-versions/IncludeGuard.h b/audio/common/all-versions/util/include/common/all-versions/IncludeGuard.h deleted file mode 100644 index 2d5481625c..0000000000 --- a/audio/common/all-versions/util/include/common/all-versions/IncludeGuard.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef AUDIO_HAL_VERSION -#error "AUDIO_HAL_VERSION must be set before including this file." -#endif diff --git a/audio/core/2.0/default/Android.bp b/audio/core/2.0/default/Android.bp deleted file mode 100644 index 625df74a88..0000000000 --- a/audio/core/2.0/default/Android.bp +++ /dev/null @@ -1,53 +0,0 @@ -cc_library_shared { - name: "android.hardware.audio@2.0-impl", - relative_install_path: "hw", - proprietary: true, - vendor: true, - srcs: [ - "Conversions.cpp", - "Device.cpp", - "DevicesFactory.cpp", - "ParametersUtil.cpp", - "PrimaryDevice.cpp", - "Stream.cpp", - "StreamIn.cpp", - "StreamOut.cpp", - ], - - cflags: [ - "-DAUDIO_HAL_VERSION_2_0", - ], - - defaults: ["hidl_defaults"], - - export_include_dirs: ["include"], - - shared_libs: [ - "libbase", - "libcutils", - "libfmq", - "libhardware", - "libhidlbase", - "libhidltransport", - "liblog", - "libutils", - "android.hardware.audio@2.0", - "android.hardware.audio.common@2.0", - "android.hardware.audio.common@2.0-util", - "android.hardware.audio.common-util", - ], - - header_libs: [ - "android.hardware.audio.common.util@all-versions", - "android.hardware.audio.core@all-versions-impl", - "libaudioclient_headers", - "libaudio_system_headers", - "libhardware_headers", - "libmedia_headers", - ], - - whole_static_libs: [ - "libmedia_helper", - ], - -} diff --git a/audio/core/2.0/default/Conversions.cpp b/audio/core/2.0/default/Conversions.cpp deleted file mode 100644 index 6c32090626..0000000000 --- a/audio/core/2.0/default/Conversions.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core/2.0/default/Conversions.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/2.0/default/Device.cpp b/audio/core/2.0/default/Device.cpp deleted file mode 100644 index b67203d50e..0000000000 --- a/audio/core/2.0/default/Device.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "DeviceHAL" - -#include "core/2.0/default/Device.h" -#include -#include "core/2.0/default/Conversions.h" -#include "core/2.0/default/StreamIn.h" -#include "core/2.0/default/StreamOut.h" -#include "core/2.0/default/Util.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/2.0/default/DevicesFactory.cpp b/audio/core/2.0/default/DevicesFactory.cpp deleted file mode 100644 index 65a9ccdc4e..0000000000 --- a/audio/core/2.0/default/DevicesFactory.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "DevicesFactoryHAL" - -#include "core/2.0/default/DevicesFactory.h" -#include "core/2.0/default/Device.h" -#include "core/2.0/default/PrimaryDevice.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/2.0/default/ParametersUtil.cpp b/audio/core/2.0/default/ParametersUtil.cpp deleted file mode 100644 index 602b2129f0..0000000000 --- a/audio/core/2.0/default/ParametersUtil.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core/2.0/default/ParametersUtil.h" -#include "core/2.0/default/Conversions.h" -#include "core/2.0/default/Util.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/2.0/default/PrimaryDevice.cpp b/audio/core/2.0/default/PrimaryDevice.cpp deleted file mode 100644 index decaa14658..0000000000 --- a/audio/core/2.0/default/PrimaryDevice.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "PrimaryDeviceHAL" - -#include "core/2.0/default/PrimaryDevice.h" -#include "core/2.0/default/Util.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/2.0/default/Stream.cpp b/audio/core/2.0/default/Stream.cpp deleted file mode 100644 index 0863a7c399..0000000000 --- a/audio/core/2.0/default/Stream.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "StreamHAL" - -#include "core/2.0/default/Stream.h" -#include "common/all-versions/default/EffectMap.h" -#include "core/2.0/default/Conversions.h" -#include "core/2.0/default/Util.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/2.0/default/StreamIn.cpp b/audio/core/2.0/default/StreamIn.cpp deleted file mode 100644 index cfd2abb376..0000000000 --- a/audio/core/2.0/default/StreamIn.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "StreamInHAL" - -#include "core/2.0/default/StreamIn.h" -#include "core/2.0/default/Conversions.h" -#include "core/2.0/default/Util.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/2.0/default/StreamOut.cpp b/audio/core/2.0/default/StreamOut.cpp deleted file mode 100644 index 940a251272..0000000000 --- a/audio/core/2.0/default/StreamOut.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "StreamOutHAL" - -#include "core/2.0/default/StreamOut.h" -#include "core/2.0/default/Util.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/2.0/default/include/core/2.0/default/Conversions.h b/audio/core/2.0/default/include/core/2.0/default/Conversions.h deleted file mode 100644 index b3a6ea886e..0000000000 --- a/audio/core/2.0/default/include/core/2.0/default/Conversions.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_ -#define ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_ - -#include - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_ diff --git a/audio/core/2.0/default/include/core/2.0/default/Device.h b/audio/core/2.0/default/include/core/2.0/default/Device.h deleted file mode 100644 index 3ec74649ec..0000000000 --- a/audio/core/2.0/default/include/core/2.0/default/Device.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H -#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H - -#include - -#include "ParametersUtil.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H diff --git a/audio/core/2.0/default/include/core/2.0/default/DevicesFactory.h b/audio/core/2.0/default/include/core/2.0/default/DevicesFactory.h deleted file mode 100644 index 8e8ee88ffa..0000000000 --- a/audio/core/2.0/default/include/core/2.0/default/DevicesFactory.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H -#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H - -#include - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H diff --git a/audio/core/2.0/default/include/core/2.0/default/ParametersUtil.h b/audio/core/2.0/default/include/core/2.0/default/ParametersUtil.h deleted file mode 100644 index a5c1c78f94..0000000000 --- a/audio/core/2.0/default/include/core/2.0/default/ParametersUtil.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_ -#define ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_ - -#include - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_ diff --git a/audio/core/2.0/default/include/core/2.0/default/PrimaryDevice.h b/audio/core/2.0/default/include/core/2.0/default/PrimaryDevice.h deleted file mode 100644 index f89859700a..0000000000 --- a/audio/core/2.0/default/include/core/2.0/default/PrimaryDevice.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H -#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H - -#include - -#include "Device.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H diff --git a/audio/core/2.0/default/include/core/2.0/default/Stream.h b/audio/core/2.0/default/include/core/2.0/default/Stream.h deleted file mode 100644 index a2d845609c..0000000000 --- a/audio/core/2.0/default/include/core/2.0/default/Stream.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H -#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H - -#include - -#include "ParametersUtil.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H diff --git a/audio/core/2.0/default/include/core/2.0/default/StreamIn.h b/audio/core/2.0/default/include/core/2.0/default/StreamIn.h deleted file mode 100644 index c36abbd68e..0000000000 --- a/audio/core/2.0/default/include/core/2.0/default/StreamIn.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H -#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H - -#include - -#include "Device.h" -#include "Stream.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H diff --git a/audio/core/2.0/default/include/core/2.0/default/StreamOut.h b/audio/core/2.0/default/include/core/2.0/default/StreamOut.h deleted file mode 100644 index ab35687414..0000000000 --- a/audio/core/2.0/default/include/core/2.0/default/StreamOut.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H -#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H - -#include - -#include "Device.h" -#include "Stream.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H diff --git a/audio/core/2.0/default/include/core/2.0/default/Util.h b/audio/core/2.0/default/include/core/2.0/default/Util.h deleted file mode 100644 index 1f0e284d0a..0000000000 --- a/audio/core/2.0/default/include/core/2.0/default/Util.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H -#define ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H - -#include - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H diff --git a/audio/core/2.0/vts/functional/Android.bp b/audio/core/2.0/vts/functional/Android.bp deleted file mode 100644 index 2f546178a9..0000000000 --- a/audio/core/2.0/vts/functional/Android.bp +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright (C) 2017 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -cc_test { - name: "VtsHalAudioV2_0TargetTest", - defaults: ["VtsHalTargetTestDefaults"], - srcs: [ - "2.0/AudioPrimaryHidlHalTest.cpp", - "ValidateAudioConfiguration.cpp" - ], - static_libs: [ - "android.hardware.audio.common.test.utility", - "android.hardware.audio@2.0", - "android.hardware.audio.common@2.0", - "libicuuc", - "libicuuc_stubdata", - "libxml2", - ], - shared_libs: [ - "libfmq", - ], - header_libs: [ - "android.hardware.audio.common.util@all-versions", - ], - test_suites: ["general-tests"], -} diff --git a/audio/core/2.0/vts/functional/ValidateAudioConfiguration.cpp b/audio/core/2.0/vts/functional/ValidateAudioConfiguration.cpp deleted file mode 100644 index 50c5333d2f..0000000000 --- a/audio/core/2.0/vts/functional/ValidateAudioConfiguration.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include "utility/ValidateXml.h" - -// Stringify the argument. -#define QUOTE(x) #x -#define STRINGIFY(x) QUOTE(x) - -#define AUDIO_HAL_VERSION V2_0 - -TEST(CheckConfig, audioPolicyConfigurationValidation) { - RecordProperty("description", - "Verify that the audio policy configuration file " - "is valid according to the schema"); - - std::vector locations = {"/odm/etc", "/vendor/etc", "/system/etc"}; - const char* xsd = - "/data/local/tmp/audio_policy_configuration_" STRINGIFY(AUDIO_HAL_VERSION) ".xsd"; - EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("audio_policy_configuration.xml", locations, xsd); -} diff --git a/audio/core/4.0/default/Android.bp b/audio/core/4.0/default/Android.bp deleted file mode 100644 index 8e415459be..0000000000 --- a/audio/core/4.0/default/Android.bp +++ /dev/null @@ -1,53 +0,0 @@ -cc_library_shared { - name: "android.hardware.audio@4.0-impl", - relative_install_path: "hw", - proprietary: true, - vendor: true, - srcs: [ - "Conversions.cpp", - "Device.cpp", - "DevicesFactory.cpp", - "ParametersUtil.cpp", - "PrimaryDevice.cpp", - "Stream.cpp", - "StreamIn.cpp", - "StreamOut.cpp", - ], - - cflags: [ - "-DAUDIO_HAL_VERSION_4_0", - ], - - defaults: ["hidl_defaults"], - - export_include_dirs: ["include"], - - shared_libs: [ - "libbase", - "libcutils", - "libfmq", - "libhardware", - "libhidlbase", - "libhidltransport", - "liblog", - "libutils", - "android.hardware.audio@4.0", - "android.hardware.audio.common@4.0", - "android.hardware.audio.common@4.0-util", - "android.hardware.audio.common-util", - ], - - header_libs: [ - "android.hardware.audio.common.util@all-versions", - "android.hardware.audio.core@all-versions-impl", - "libaudioclient_headers", - "libaudio_system_headers", - "libhardware_headers", - "libmedia_headers", - ], - - whole_static_libs: [ - "libmedia_helper", - ], - -} diff --git a/audio/core/4.0/default/Conversions.cpp b/audio/core/4.0/default/Conversions.cpp deleted file mode 100644 index 4f1874412c..0000000000 --- a/audio/core/4.0/default/Conversions.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core/4.0/default/Conversions.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/4.0/default/Device.cpp b/audio/core/4.0/default/Device.cpp deleted file mode 100644 index b33434ecfb..0000000000 --- a/audio/core/4.0/default/Device.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "DeviceHAL" - -#include "core/4.0/default/Device.h" -#include -#include "core/4.0/default/Conversions.h" -#include "core/4.0/default/StreamIn.h" -#include "core/4.0/default/StreamOut.h" -#include "core/4.0/default/Util.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/4.0/default/DevicesFactory.cpp b/audio/core/4.0/default/DevicesFactory.cpp deleted file mode 100644 index cb8a3c3e97..0000000000 --- a/audio/core/4.0/default/DevicesFactory.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "DevicesFactoryHAL" - -#include "core/4.0/default/DevicesFactory.h" -#include "core/4.0/default/Device.h" -#include "core/4.0/default/PrimaryDevice.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/4.0/default/OWNERS b/audio/core/4.0/default/OWNERS deleted file mode 100644 index 6fdc97ca29..0000000000 --- a/audio/core/4.0/default/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -elaurent@google.com -krocard@google.com -mnaganov@google.com diff --git a/audio/core/4.0/default/ParametersUtil.cpp b/audio/core/4.0/default/ParametersUtil.cpp deleted file mode 100644 index b90a8e79e1..0000000000 --- a/audio/core/4.0/default/ParametersUtil.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "core/4.0/default/ParametersUtil.h" -#include "core/4.0/default/Conversions.h" -#include "core/4.0/default/Util.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/4.0/default/PrimaryDevice.cpp b/audio/core/4.0/default/PrimaryDevice.cpp deleted file mode 100644 index e3e49768d5..0000000000 --- a/audio/core/4.0/default/PrimaryDevice.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "PrimaryDeviceHAL" - -#include "core/4.0/default/PrimaryDevice.h" -#include "core/4.0/default/Util.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/4.0/default/Stream.cpp b/audio/core/4.0/default/Stream.cpp deleted file mode 100644 index b8c71de7b7..0000000000 --- a/audio/core/4.0/default/Stream.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "StreamHAL" - -#include "core/4.0/default/Stream.h" -#include "common/all-versions/default/EffectMap.h" -#include "core/4.0/default/Conversions.h" -#include "core/4.0/default/Util.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/4.0/default/StreamIn.cpp b/audio/core/4.0/default/StreamIn.cpp deleted file mode 100644 index 11a7a80314..0000000000 --- a/audio/core/4.0/default/StreamIn.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "StreamInHAL" - -#include "core/4.0/default/StreamIn.h" -#include "core/4.0/default/Conversions.h" -#include "core/4.0/default/Util.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/4.0/default/StreamOut.cpp b/audio/core/4.0/default/StreamOut.cpp deleted file mode 100644 index db88e401d2..0000000000 --- a/audio/core/4.0/default/StreamOut.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "StreamOutHAL" - -#include "core/4.0/default/StreamOut.h" -#include "core/4.0/default/Util.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/core/4.0/default/include/core/4.0/default/Conversions.h b/audio/core/4.0/default/include/core/4.0/default/Conversions.h deleted file mode 100644 index 32c2f887ee..0000000000 --- a/audio/core/4.0/default/include/core/4.0/default/Conversions.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_ -#define ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_ - -#include - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_ diff --git a/audio/core/4.0/default/include/core/4.0/default/Device.h b/audio/core/4.0/default/include/core/4.0/default/Device.h deleted file mode 100644 index 770d606720..0000000000 --- a/audio/core/4.0/default/include/core/4.0/default/Device.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H -#define ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H - -#include - -#include "ParametersUtil.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H diff --git a/audio/core/4.0/default/include/core/4.0/default/DevicesFactory.h b/audio/core/4.0/default/include/core/4.0/default/DevicesFactory.h deleted file mode 100644 index 200e59d96f..0000000000 --- a/audio/core/4.0/default/include/core/4.0/default/DevicesFactory.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H -#define ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H - -#include - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H diff --git a/audio/core/4.0/default/include/core/4.0/default/ParametersUtil.h b/audio/core/4.0/default/include/core/4.0/default/ParametersUtil.h deleted file mode 100644 index fa31ee9dd3..0000000000 --- a/audio/core/4.0/default/include/core/4.0/default/ParametersUtil.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_ -#define ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_ - -#include - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_ diff --git a/audio/core/4.0/default/include/core/4.0/default/PrimaryDevice.h b/audio/core/4.0/default/include/core/4.0/default/PrimaryDevice.h deleted file mode 100644 index e7f846b622..0000000000 --- a/audio/core/4.0/default/include/core/4.0/default/PrimaryDevice.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H -#define ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H - -#include - -#include "Device.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H diff --git a/audio/core/4.0/default/include/core/4.0/default/Stream.h b/audio/core/4.0/default/include/core/4.0/default/Stream.h deleted file mode 100644 index afad80fe53..0000000000 --- a/audio/core/4.0/default/include/core/4.0/default/Stream.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H -#define ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H - -#include - -#include "ParametersUtil.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H diff --git a/audio/core/4.0/default/include/core/4.0/default/StreamIn.h b/audio/core/4.0/default/include/core/4.0/default/StreamIn.h deleted file mode 100644 index 151f03fc2b..0000000000 --- a/audio/core/4.0/default/include/core/4.0/default/StreamIn.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H -#define ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H - -#include - -#include "Device.h" -#include "Stream.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H diff --git a/audio/core/4.0/default/include/core/4.0/default/StreamOut.h b/audio/core/4.0/default/include/core/4.0/default/StreamOut.h deleted file mode 100644 index dbf3bd16ce..0000000000 --- a/audio/core/4.0/default/include/core/4.0/default/StreamOut.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H -#define ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H - -#include - -#include "Device.h" -#include "Stream.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H diff --git a/audio/core/4.0/default/include/core/4.0/default/Util.h b/audio/core/4.0/default/include/core/4.0/default/Util.h deleted file mode 100644 index ce31e6f7f2..0000000000 --- a/audio/core/4.0/default/include/core/4.0/default/Util.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_V4_0_UTIL_H -#define ANDROID_HARDWARE_AUDIO_V4_0_UTIL_H - -#include - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_V4_0_UTIL_H diff --git a/audio/core/4.0/vts/OWNERS b/audio/core/4.0/vts/OWNERS deleted file mode 100644 index 8711a9ff6a..0000000000 --- a/audio/core/4.0/vts/OWNERS +++ /dev/null @@ -1,5 +0,0 @@ -elaurent@google.com -krocard@google.com -mnaganov@google.com -yim@google.com -zhuoyao@google.com \ No newline at end of file diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.h deleted file mode 100644 index 1d543b4521..0000000000 --- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.h +++ /dev/null @@ -1,1253 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "VtsHalAudioV4_0TargetTest" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "utility/AssertOk.h" -#include "utility/Documentation.h" -#include "utility/EnvironmentTearDown.h" -#define AUDIO_HAL_VERSION V4_0 -#include "utility/PrettyPrintAudioTypes.h" -#include "utility/ReturnIn.h" - -/** Provide version specific functions that are used in the generic tests */ -#include "4.0/AudioPrimaryHidlHalUtils.h" - -using std::initializer_list; -using std::list; -using std::string; -using std::to_string; -using std::vector; - -using ::android::sp; -using ::android::hardware::EventFlag; -using ::android::hardware::hidl_bitfield; -using ::android::hardware::hidl_enum_range; -using ::android::hardware::hidl_handle; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; -using ::android::hardware::IPCThreadState; -using ::android::hardware::kSynchronizedReadWrite; -using ::android::hardware::MessageQueue; -using ::android::hardware::MQDescriptorSync; -using ::android::hardware::Return; -using ::android::hardware::audio::V4_0::AudioDrain; -using ::android::hardware::audio::V4_0::DeviceAddress; -using ::android::hardware::audio::V4_0::IDevice; -using ::android::hardware::audio::V4_0::IPrimaryDevice; -using TtyMode = ::android::hardware::audio::V4_0::IPrimaryDevice::TtyMode; -using ::android::hardware::audio::V4_0::IDevicesFactory; -using ::android::hardware::audio::V4_0::IStream; -using ::android::hardware::audio::V4_0::IStreamIn; -using ::android::hardware::audio::V4_0::MessageQueueFlagBits; -using ::android::hardware::audio::V4_0::TimeSpec; -using ReadParameters = ::android::hardware::audio::V4_0::IStreamIn::ReadParameters; -using ReadStatus = ::android::hardware::audio::V4_0::IStreamIn::ReadStatus; -using ::android::hardware::audio::common::utils::mkEnumBitfield; -using ::android::hardware::audio::common::V4_0::AudioChannelMask; -using ::android::hardware::audio::common::V4_0::AudioConfig; -using ::android::hardware::audio::common::V4_0::AudioDevice; -using ::android::hardware::audio::common::V4_0::AudioFormat; -using ::android::hardware::audio::common::V4_0::AudioHandleConsts; -using ::android::hardware::audio::common::V4_0::AudioHwSync; -using ::android::hardware::audio::common::V4_0::AudioInputFlag; -using ::android::hardware::audio::common::V4_0::AudioIoHandle; -using ::android::hardware::audio::common::V4_0::AudioMode; -using ::android::hardware::audio::common::V4_0::AudioOffloadInfo; -using ::android::hardware::audio::common::V4_0::AudioOutputFlag; -using ::android::hardware::audio::common::V4_0::AudioSource; -using ::android::hardware::audio::common::V4_0::ThreadInfo; -using ::android::hardware::audio::V4_0::IStreamOut; -using ::android::hardware::audio::V4_0::IStreamOutCallback; -using ::android::hardware::audio::V4_0::MmapBufferInfo; -using ::android::hardware::audio::V4_0::MmapPosition; -using ::android::hardware::audio::V4_0::ParameterValue; -using ::android::hardware::audio::V4_0::Result; - -using namespace ::android::hardware::audio::common::test::utility; - -// Typical accepted results from interface methods -static auto okOrNotSupported = {Result::OK, Result::NOT_SUPPORTED}; -static auto okOrNotSupportedOrInvalidArgs = {Result::OK, Result::NOT_SUPPORTED, - Result::INVALID_ARGUMENTS}; -static auto okOrInvalidStateOrNotSupported = {Result::OK, Result::INVALID_STATE, - Result::NOT_SUPPORTED}; -static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED}; -static auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED}; - -class AudioHidlTestEnvironment : public ::Environment { - public: - virtual void registerTestServices() override { registerTestService(); } -}; - -// Instance to register global tearDown -static AudioHidlTestEnvironment* environment; - -class HidlTest : public ::testing::VtsHalHidlTargetTestBase { - protected: - // Convenient member to store results - Result res; -}; - -////////////////////////////////////////////////////////////////////////////// -////////////////////// getService audio_devices_factory ////////////////////// -////////////////////////////////////////////////////////////////////////////// - -// Test all audio devices -class AudioHidlTest : public HidlTest { - public: - void SetUp() override { - ASSERT_NO_FATAL_FAILURE(HidlTest::SetUp()); // setup base - - if (devicesFactory == nullptr) { - environment->registerTearDown([] { devicesFactory.clear(); }); - devicesFactory = ::testing::VtsHalHidlTargetTestBase::getService( - environment->getServiceName("default")); - } - ASSERT_TRUE(devicesFactory != nullptr); - } - - protected: - // Cache the devicesFactory retrieval to speed up each test by ~0.5s - static sp devicesFactory; -}; -sp AudioHidlTest::devicesFactory; - -TEST_F(AudioHidlTest, GetAudioDevicesFactoryService) { - doc::test("Test the getService (called in SetUp)"); -} - -TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) { - doc::test("Test passing an invalid parameter to openDevice"); - Result result; - sp device; - auto invalidDevice = "Non existing device"; - ASSERT_OK(devicesFactory->openDevice(invalidDevice, returnIn(result, device))); - ASSERT_EQ(Result::INVALID_ARGUMENTS, result); - ASSERT_TRUE(device == nullptr); -} - -////////////////////////////////////////////////////////////////////////////// -/////////////////////////////// openDevice primary /////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -// Test the primary device -class AudioPrimaryHidlTest : public AudioHidlTest { - public: - /** Primary HAL test are NOT thread safe. */ - void SetUp() override { - ASSERT_NO_FATAL_FAILURE(AudioHidlTest::SetUp()); // setup base - - if (device == nullptr) { - initPrimaryDevice(); - ASSERT_TRUE(device != nullptr); - environment->registerTearDown([] { device.clear(); }); - } - } - - protected: - // Cache the device opening to speed up each test by ~0.5s - static sp device; - - private: - void initPrimaryDevice() { - Result result; - ASSERT_OK(devicesFactory->openPrimaryDevice(returnIn(result, device))); - ASSERT_OK(result); - } -}; -sp AudioPrimaryHidlTest::device; - -TEST_F(AudioPrimaryHidlTest, OpenPrimaryDevice) { - doc::test("Test the openDevice (called in SetUp)"); -} - -TEST_F(AudioPrimaryHidlTest, Init) { - doc::test("Test that the audio primary hal initialized correctly"); - ASSERT_OK(device->initCheck()); -} - -////////////////////////////////////////////////////////////////////////////// -///////////////////// {set,get}{Master,Mic}{Mute,Volume} ///////////////////// -////////////////////////////////////////////////////////////////////////////// - -template -class AccessorPrimaryHidlTest : public AudioPrimaryHidlTest { - protected: - enum Optionality { REQUIRED, OPTIONAL }; - struct Initial { // Initial property value - Initial(Property value, Optionality check = REQUIRED) : value(value), check(check) {} - Property value; - Optionality check; // If this initial value should be checked - }; - /** Test a property getter and setter. - * The getter and/or the setter may return NOT_SUPPORTED if optionality == OPTIONAL. - */ - template - void testAccessors(const string& propertyName, const Initial expectedInitial, - list valuesToTest, Setter setter, Getter getter, - const vector& invalidValues = {}) { - const auto expectedResults = {Result::OK, - optionality == OPTIONAL ? Result::NOT_SUPPORTED : Result::OK}; - - Property initialValue = expectedInitial.value; - ASSERT_OK((device.get()->*getter)(returnIn(res, initialValue))); - ASSERT_RESULT(expectedResults, res); - if (res == Result::OK && expectedInitial.check == REQUIRED) { - EXPECT_EQ(expectedInitial.value, initialValue); - } - - valuesToTest.push_front(expectedInitial.value); - valuesToTest.push_back(initialValue); - for (Property setValue : valuesToTest) { - SCOPED_TRACE("Test " + propertyName + " getter and setter for " + - testing::PrintToString(setValue)); - auto ret = (device.get()->*setter)(setValue); - ASSERT_RESULT(expectedResults, ret); - if (ret == Result::NOT_SUPPORTED) { - doc::partialTest(propertyName + " setter is not supported"); - break; - } - Property getValue; - // Make sure the getter returns the same value just set - ASSERT_OK((device.get()->*getter)(returnIn(res, getValue))); - ASSERT_RESULT(expectedResults, res); - if (res == Result::NOT_SUPPORTED) { - doc::partialTest(propertyName + " getter is not supported"); - continue; - } - EXPECT_EQ(setValue, getValue); - } - - for (Property invalidValue : invalidValues) { - SCOPED_TRACE("Try to set " + propertyName + " with the invalid value " + - testing::PrintToString(invalidValue)); - EXPECT_RESULT(invalidArgsOrNotSupported, (device.get()->*setter)(invalidValue)); - } - - // Restore initial value - EXPECT_RESULT(expectedResults, (device.get()->*setter)(initialValue)); - } -}; - -using BoolAccessorPrimaryHidlTest = AccessorPrimaryHidlTest; - -TEST_F(BoolAccessorPrimaryHidlTest, MicMuteTest) { - doc::test("Check that the mic can be muted and unmuted"); - testAccessors("mic mute", Initial{false}, {true}, &IDevice::setMicMute, &IDevice::getMicMute); - // TODO: check that the mic is really muted (all sample are 0) -} - -TEST_F(BoolAccessorPrimaryHidlTest, MasterMuteTest) { - doc::test("If master mute is supported, try to mute and unmute the master output"); - testAccessors("master mute", Initial{false}, {true}, &IDevice::setMasterMute, - &IDevice::getMasterMute); - // TODO: check that the master volume is really muted -} - -using FloatAccessorPrimaryHidlTest = AccessorPrimaryHidlTest; -TEST_F(FloatAccessorPrimaryHidlTest, MasterVolumeTest) { - doc::test("Test the master volume if supported"); - testAccessors( - "master volume", Initial{1}, {0, 0.5}, &IDevice::setMasterVolume, &IDevice::getMasterVolume, - {-0.1, 1.1, NAN, INFINITY, -INFINITY, 1 + std::numeric_limits::epsilon()}); - // TODO: check that the master volume is really changed -} - -////////////////////////////////////////////////////////////////////////////// -//////////////////////////////// AudioPatches //////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -class AudioPatchPrimaryHidlTest : public AudioPrimaryHidlTest { - protected: - bool areAudioPatchesSupported() { - auto result = device->supportsAudioPatches(); - EXPECT_IS_OK(result); - return result; - } -}; - -TEST_F(AudioPatchPrimaryHidlTest, AudioPatches) { - doc::test("Test if audio patches are supported"); - if (!areAudioPatchesSupported()) { - doc::partialTest("Audio patches are not supported"); - return; - } - // TODO: test audio patches -} - -////////////////////////////////////////////////////////////////////////////// -//////////////// Required and recommended audio format support /////////////// -// From: -// https://source.android.com/compatibility/android-cdd.html#5_4_audio_recording -// From: -// https://source.android.com/compatibility/android-cdd.html#5_5_audio_playback -/////////// TODO: move to the beginning of the file for easier update //////// -////////////////////////////////////////////////////////////////////////////// - -class AudioConfigPrimaryTest : public AudioPatchPrimaryHidlTest { - public: - // Cache result ? - static const vector getRequiredSupportPlaybackAudioConfig() { - return combineAudioConfig({AudioChannelMask::OUT_STEREO, AudioChannelMask::OUT_MONO}, - {8000, 11025, 16000, 22050, 32000, 44100}, - {AudioFormat::PCM_16_BIT}); - } - - static const vector getRecommendedSupportPlaybackAudioConfig() { - return combineAudioConfig({AudioChannelMask::OUT_STEREO, AudioChannelMask::OUT_MONO}, - {24000, 48000}, {AudioFormat::PCM_16_BIT}); - } - - static const vector getSupportedPlaybackAudioConfig() { - // TODO: retrieve audio config supported by the platform - // as declared in the policy configuration - return {}; - } - - static const vector getRequiredSupportCaptureAudioConfig() { - return combineAudioConfig({AudioChannelMask::IN_MONO}, {8000, 11025, 16000, 44100}, - {AudioFormat::PCM_16_BIT}); - } - static const vector getRecommendedSupportCaptureAudioConfig() { - return combineAudioConfig({AudioChannelMask::IN_STEREO}, {22050, 48000}, - {AudioFormat::PCM_16_BIT}); - } - static const vector getSupportedCaptureAudioConfig() { - // TODO: retrieve audio config supported by the platform - // as declared in the policy configuration - return {}; - } - - private: - static const vector combineAudioConfig(vector channelMasks, - vector sampleRates, - vector formats) { - vector configs; - for (auto channelMask : channelMasks) { - for (auto sampleRate : sampleRates) { - for (auto format : formats) { - AudioConfig config{}; - // leave offloadInfo to 0 - config.channelMask = mkEnumBitfield(channelMask); - config.sampleRateHz = sampleRate; - config.format = format; - // FIXME: leave frameCount to 0 ? - configs.push_back(config); - } - } - } - return configs; - } -}; - -/** Generate a test name based on an audio config. - * - * As the only parameter changing are channel mask and sample rate, - * only print those ones in the test name. - */ -static string generateTestName(const testing::TestParamInfo& info) { - const AudioConfig& config = info.param; - return to_string(info.index) + "__" + to_string(config.sampleRateHz) + "_" + - // "MONO" is more clear than "FRONT_LEFT" - ((config.channelMask == mkEnumBitfield(AudioChannelMask::OUT_MONO) || - config.channelMask == mkEnumBitfield(AudioChannelMask::IN_MONO)) - ? "MONO" - : ::testing::PrintToString(config.channelMask)); -} - -////////////////////////////////////////////////////////////////////////////// -///////////////////////////// getInputBufferSize ///////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -// FIXME: execute input test only if platform declares -// android.hardware.microphone -// how to get this value ? is it a property ??? - -class AudioCaptureConfigPrimaryTest : public AudioConfigPrimaryTest, - public ::testing::WithParamInterface { - protected: - void inputBufferSizeTest(const AudioConfig& audioConfig, bool supportRequired) { - uint64_t bufferSize; - ASSERT_OK(device->getInputBufferSize(audioConfig, returnIn(res, bufferSize))); - - switch (res) { - case Result::INVALID_ARGUMENTS: - EXPECT_FALSE(supportRequired); - break; - case Result::OK: - // Check that the buffer is of a sane size - // For now only that it is > 0 - EXPECT_GT(bufferSize, uint64_t(0)); - break; - default: - FAIL() << "Invalid return status: " << ::testing::PrintToString(res); - } - } -}; - -// Test that the required capture config and those declared in the policy are -// indeed supported -class RequiredInputBufferSizeTest : public AudioCaptureConfigPrimaryTest {}; -TEST_P(RequiredInputBufferSizeTest, RequiredInputBufferSizeTest) { - doc::test( - "Input buffer size must be retrievable for a format with required " - "support."); - inputBufferSizeTest(GetParam(), true); -} -INSTANTIATE_TEST_CASE_P( - RequiredInputBufferSize, RequiredInputBufferSizeTest, - ::testing::ValuesIn(AudioConfigPrimaryTest::getRequiredSupportCaptureAudioConfig()), - &generateTestName); -INSTANTIATE_TEST_CASE_P( - SupportedInputBufferSize, RequiredInputBufferSizeTest, - ::testing::ValuesIn(AudioConfigPrimaryTest::getSupportedCaptureAudioConfig()), - &generateTestName); - -// Test that the recommended capture config are supported or lead to a -// INVALID_ARGUMENTS return -class OptionalInputBufferSizeTest : public AudioCaptureConfigPrimaryTest {}; -TEST_P(OptionalInputBufferSizeTest, OptionalInputBufferSizeTest) { - doc::test( - "Input buffer size should be retrievable for a format with recommended " - "support."); - inputBufferSizeTest(GetParam(), false); -} -INSTANTIATE_TEST_CASE_P( - RecommendedCaptureAudioConfigSupport, OptionalInputBufferSizeTest, - ::testing::ValuesIn(AudioConfigPrimaryTest::getRecommendedSupportCaptureAudioConfig()), - &generateTestName); - -////////////////////////////////////////////////////////////////////////////// -/////////////////////////////// setScreenState /////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -TEST_F(AudioPrimaryHidlTest, setScreenState) { - doc::test("Check that the hal can receive the screen state"); - for (bool turnedOn : {false, true, true, false, false}) { - ASSERT_RESULT(okOrNotSupported, device->setScreenState(turnedOn)); - } -} - -////////////////////////////////////////////////////////////////////////////// -//////////////////////////// {get,set}Parameters ///////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -TEST_F(AudioPrimaryHidlTest, getParameters) { - doc::test("Check that the hal can set and get parameters"); - hidl_vec context; - hidl_vec keys; - hidl_vec values; - ASSERT_OK(Parameters::get(device, keys, returnIn(res, values))); - ASSERT_OK(Parameters::set(device, values)); - values.resize(0); - ASSERT_OK(Parameters::set(device, values)); -} - -////////////////////////////////////////////////////////////////////////////// -//////////////////////////////// debugDebug ////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -template -static void testDebugDump(DebugDump debugDump) { - // File descriptors to our pipe. fds[0] corresponds to the read end and - // fds[1] to the write end. - int fds[2]; - ASSERT_EQ(0, pipe2(fds, O_NONBLOCK)) << errno; - - // Make sure that the pipe is at least 1 MB in size. The test process runs - // in su domain, so it should be safe to make this call. - fcntl(fds[0], F_SETPIPE_SZ, 1 << 20); - - // Wrap the temporary file file descriptor in a native handle - auto* nativeHandle = native_handle_create(1, 0); - ASSERT_NE(nullptr, nativeHandle); - nativeHandle->data[0] = fds[1]; - - // Wrap this native handle in a hidl handle - hidl_handle handle; - handle.setTo(nativeHandle, false /*take ownership*/); - - ASSERT_OK(debugDump(handle)); - - // Check that at least one bit was written by the hal - // TODO: debugDump does not return a Result. - // This mean that the hal can not report that it not implementing the - // function. - char buff; - if (read(fds[0], &buff, 1) != 1) { - doc::note("debugDump does not seem implemented"); - } - EXPECT_EQ(0, close(fds[0])) << errno; - EXPECT_EQ(0, close(fds[1])) << errno; -} - -TEST_F(AudioPrimaryHidlTest, DebugDump) { - doc::test("Check that the hal can dump its state without error"); - testDebugDump([](const auto& handle) { return dump(device, handle); }); -} - -TEST_F(AudioPrimaryHidlTest, DebugDumpInvalidArguments) { - doc::test("Check that the hal dump doesn't crash on invalid arguments"); - ASSERT_OK(dump(device, hidl_handle())); -} - -////////////////////////////////////////////////////////////////////////////// -////////////////////////// open{Output,Input}Stream ////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -template -class OpenStreamTest : public AudioConfigPrimaryTest, - public ::testing::WithParamInterface { - protected: - template - void testOpen(Open openStream, const AudioConfig& config) { - // FIXME: Open a stream without an IOHandle - // This is not required to be accepted by hal implementations - AudioIoHandle ioHandle = (AudioIoHandle)AudioHandleConsts::AUDIO_IO_HANDLE_NONE; - AudioConfig suggestedConfig{}; - ASSERT_OK(openStream(ioHandle, config, returnIn(res, stream, suggestedConfig))); - - // TODO: only allow failure for RecommendedPlaybackAudioConfig - switch (res) { - case Result::OK: - ASSERT_TRUE(stream != nullptr); - audioConfig = config; - break; - case Result::INVALID_ARGUMENTS: - ASSERT_TRUE(stream == nullptr); - AudioConfig suggestedConfigRetry; - // Could not open stream with config, try again with the - // suggested one - ASSERT_OK(openStream(ioHandle, suggestedConfig, - returnIn(res, stream, suggestedConfigRetry))); - // This time it must succeed - ASSERT_OK(res); - ASSERT_TRUE(stream != nullptr); - audioConfig = suggestedConfig; - break; - default: - FAIL() << "Invalid return status: " << ::testing::PrintToString(res); - } - open = true; - } - - Return closeStream() { - open = false; - return stream->close(); - } - - private: - void TearDown() override { - if (open) { - ASSERT_OK(stream->close()); - } - } - - protected: - AudioConfig audioConfig; - DeviceAddress address = {}; - sp stream; - bool open = false; -}; - -////////////////////////////// openOutputStream ////////////////////////////// - -class OutputStreamTest : public OpenStreamTest { - virtual void SetUp() override { - ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base - address.device = AudioDevice::OUT_DEFAULT; - const AudioConfig& config = GetParam(); - // TODO: test all flag combination - auto flags = mkEnumBitfield(AudioOutputFlag::NONE); - testOpen( - [&](AudioIoHandle handle, AudioConfig config, auto cb) { - return device->openOutputStream(handle, address, config, flags, initMetadata, cb); - }, - config); - } - - protected: - const SourceMetadata initMetadata = { - {{AudioUsage::MEDIA, AudioContentType::MUSIC, 1 /* gain */}}}; -}; -TEST_P(OutputStreamTest, OpenOutputStreamTest) { - doc::test( - "Check that output streams can be open with the required and " - "recommended config"); - // Open done in SetUp -} -INSTANTIATE_TEST_CASE_P( - RequiredOutputStreamConfigSupport, OutputStreamTest, - ::testing::ValuesIn(AudioConfigPrimaryTest::getRequiredSupportPlaybackAudioConfig()), - &generateTestName); -INSTANTIATE_TEST_CASE_P( - SupportedOutputStreamConfig, OutputStreamTest, - ::testing::ValuesIn(AudioConfigPrimaryTest::getSupportedPlaybackAudioConfig()), - &generateTestName); - -INSTANTIATE_TEST_CASE_P( - RecommendedOutputStreamConfigSupport, OutputStreamTest, - ::testing::ValuesIn(AudioConfigPrimaryTest::getRecommendedSupportPlaybackAudioConfig()), - &generateTestName); - -////////////////////////////// openInputStream ////////////////////////////// - -class InputStreamTest : public OpenStreamTest { - virtual void SetUp() override { - ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base - address.device = AudioDevice::IN_DEFAULT; - const AudioConfig& config = GetParam(); - // TODO: test all supported flags and source - auto flags = mkEnumBitfield(AudioInputFlag::NONE); - testOpen( - [&](AudioIoHandle handle, AudioConfig config, auto cb) { - return device->openInputStream(handle, address, config, flags, initMetadata, cb); - }, - config); - } - - protected: - const SinkMetadata initMetadata = {{{AudioSource::DEFAULT, 1 /* gain */}}}; -}; - -TEST_P(InputStreamTest, OpenInputStreamTest) { - doc::test( - "Check that input streams can be open with the required and " - "recommended config"); - // Open done in setup -} -INSTANTIATE_TEST_CASE_P( - RequiredInputStreamConfigSupport, InputStreamTest, - ::testing::ValuesIn(AudioConfigPrimaryTest::getRequiredSupportCaptureAudioConfig()), - &generateTestName); -INSTANTIATE_TEST_CASE_P( - SupportedInputStreamConfig, InputStreamTest, - ::testing::ValuesIn(AudioConfigPrimaryTest::getSupportedCaptureAudioConfig()), - &generateTestName); - -INSTANTIATE_TEST_CASE_P( - RecommendedInputStreamConfigSupport, InputStreamTest, - ::testing::ValuesIn(AudioConfigPrimaryTest::getRecommendedSupportCaptureAudioConfig()), - &generateTestName); - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////// IStream getters /////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -/** Unpack the provided result. - * If the result is not OK, register a failure and return an undefined value. */ -template -static R extract(Return ret) { - if (!ret.isOk()) { - EXPECT_IS_OK(ret); - return R{}; - } - return ret; -} - -/* Could not find a way to write a test for two parametrized class fixure - * thus use this macro do duplicate tests for Input and Output stream */ -#define TEST_IO_STREAM(test_name, documentation, code) \ - TEST_P(InputStreamTest, test_name) { \ - doc::test(documentation); \ - code; \ - } \ - TEST_P(OutputStreamTest, test_name) { \ - doc::test(documentation); \ - code; \ - } - -TEST_IO_STREAM(GetFrameCount, "Check that getting stream frame count does not crash the HAL.", - ASSERT_TRUE(stream->getFrameCount().isOk())) - -TEST_IO_STREAM(GetSampleRate, "Check that the stream sample rate == the one it was opened with", - ASSERT_EQ(audioConfig.sampleRateHz, extract(stream->getSampleRate()))) - -TEST_IO_STREAM(GetChannelMask, "Check that the stream channel mask == the one it was opened with", - ASSERT_EQ(audioConfig.channelMask, extract(stream->getChannelMask()))) - -TEST_IO_STREAM(GetFormat, "Check that the stream format == the one it was opened with", - ASSERT_EQ(audioConfig.format, extract(stream->getFormat()))) - -// TODO: for now only check that the framesize is not incoherent -TEST_IO_STREAM(GetFrameSize, "Check that the stream frame size == the one it was opened with", - ASSERT_GT(extract(stream->getFrameSize()), 0U)) - -TEST_IO_STREAM(GetBufferSize, "Check that the stream buffer size== the one it was opened with", - ASSERT_GE(extract(stream->getBufferSize()), extract(stream->getFrameSize()))); - -template -static void testCapabilityGetter(const string& name, IStream* stream, - CapabilityGetter capabilityGetter, - Return (IStream::*getter)(), - Return (IStream::*setter)(Property), - bool currentMustBeSupported = true) { - hidl_vec capabilities; - auto ret = capabilityGetter(stream, capabilities); - ASSERT_RESULT(okOrNotSupported, ret); - bool notSupported = ret == Result::NOT_SUPPORTED; - if (notSupported) { - doc::partialTest(name + " is not supported"); - return; - }; - - if (currentMustBeSupported) { - ASSERT_NE(0U, capabilities.size()) << name << " must not return an empty list"; - Property currentValue = extract((stream->*getter)()); - EXPECT_TRUE(std::find(capabilities.begin(), capabilities.end(), currentValue) != - capabilities.end()) - << "value returned by " << name << "() = " << testing::PrintToString(currentValue) - << " is not in the list of the supported ones " << toString(capabilities); - } - - // Check that all declared supported values are indeed supported - for (auto capability : capabilities) { - auto ret = (stream->*setter)(capability); - ASSERT_TRUE(ret.isOk()); - if (ret == Result::NOT_SUPPORTED) { - doc::partialTest("Setter is not supported"); - return; - } - ASSERT_OK(ret); - ASSERT_EQ(capability, extract((stream->*getter)())); - } -} - -TEST_IO_STREAM(SupportedSampleRate, "Check that the stream sample rate is declared as supported", - testCapabilityGetter("getSupportedSampleRate", stream.get(), - &GetSupported::sampleRates, &IStream::getSampleRate, - &IStream::setSampleRate, - // getSupportedSampleRate returns the native sampling rates, - // (the sampling rates that can be played without resampling) - // but other sampling rates can be supported by the HAL. - false)) - -TEST_IO_STREAM(SupportedChannelMask, "Check that the stream channel mask is declared as supported", - testCapabilityGetter("getSupportedChannelMask", stream.get(), - &GetSupported::channelMasks, &IStream::getChannelMask, - &IStream::setChannelMask)) - -TEST_IO_STREAM(SupportedFormat, "Check that the stream format is declared as supported", - testCapabilityGetter("getSupportedFormat", stream.get(), &GetSupported::formats, - &IStream::getFormat, &IStream::setFormat)) - -static void testGetAudioProperties(IStream* stream, AudioConfig expectedConfig) { - uint32_t sampleRateHz; - auto mask = mkEnumBitfield({}); - AudioFormat format; - - stream->getAudioProperties(returnIn(sampleRateHz, mask, format)); - - // FIXME: the qcom hal it does not currently negotiate the sampleRate & - // channel mask - EXPECT_EQ(expectedConfig.sampleRateHz, sampleRateHz); - EXPECT_EQ(expectedConfig.channelMask, mask); - EXPECT_EQ(expectedConfig.format, format); -} - -TEST_IO_STREAM(GetAudioProperties, - "Check that the stream audio properties == the ones it was opened with", - testGetAudioProperties(stream.get(), audioConfig)) - -TEST_IO_STREAM(SetHwAvSync, "Try to set hardware sync to an invalid value", - ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, stream->setHwAvSync(666))) - -static void checkGetNoParameter(IStream* stream, hidl_vec keys, - initializer_list expectedResults) { - hidl_vec parameters; - Result res; - ASSERT_OK(Parameters::get(stream, keys, returnIn(res, parameters))); - ASSERT_RESULT(expectedResults, res); - if (res == Result::OK) { - for (auto& parameter : parameters) { - ASSERT_EQ(0U, parameter.value.size()) << toString(parameter); - } - } -} - -/* Get/Set parameter is intended to be an opaque channel between vendors app and - * their HALs. - * Thus can not be meaningfully tested. - */ -TEST_IO_STREAM(getEmptySetParameter, "Retrieve the values of an empty set", - checkGetNoParameter(stream.get(), {} /* keys */, {Result::OK})) - -TEST_IO_STREAM(getNonExistingParameter, "Retrieve the values of an non existing parameter", - checkGetNoParameter(stream.get(), {"Non existing key"} /* keys */, - {Result::NOT_SUPPORTED})) - -TEST_IO_STREAM(setEmptySetParameter, "Set the values of an empty set of parameters", - ASSERT_RESULT(Result::OK, Parameters::set(stream, {}))) - -TEST_IO_STREAM(setNonExistingParameter, "Set the values of an non existing parameter", - // Unfortunately, the set_parameter legacy interface did not return any - // error code when a key is not supported. - // To allow implementation to just wrapped the legacy one, consider OK as a - // valid result for setting a non existing parameter. - ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, - Parameters::set(stream, {{"non existing key", "0"}}))) - -TEST_IO_STREAM(DebugDump, "Check that a stream can dump its state without error", - testDebugDump([this](const auto& handle) { return dump(stream, handle); })) - -TEST_IO_STREAM(DebugDumpInvalidArguments, - "Check that the stream dump doesn't crash on invalid arguments", - ASSERT_OK(dump(stream, hidl_handle()))) - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////// addRemoveEffect /////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -TEST_IO_STREAM(AddNonExistingEffect, "Adding a non existing effect should fail", - ASSERT_RESULT(Result::INVALID_ARGUMENTS, stream->addEffect(666))) -TEST_IO_STREAM(RemoveNonExistingEffect, "Removing a non existing effect should fail", - ASSERT_RESULT(Result::INVALID_ARGUMENTS, stream->removeEffect(666))) - -// TODO: positive tests - -////////////////////////////////////////////////////////////////////////////// -/////////////////////////////// Control //////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -TEST_IO_STREAM(standby, "Make sure the stream can be put in stanby", - ASSERT_OK(stream->standby())) // can not fail - -TEST_IO_STREAM(startNoMmap, "Starting a mmaped stream before mapping it should fail", - ASSERT_RESULT(invalidStateOrNotSupported, stream->start())) - -TEST_IO_STREAM(stopNoMmap, "Stopping a mmaped stream before mapping it should fail", - ASSERT_RESULT(invalidStateOrNotSupported, stream->stop())) - -TEST_IO_STREAM(getMmapPositionNoMmap, "Get a stream Mmap position before mapping it should fail", - ASSERT_RESULT(invalidStateOrNotSupported, stream->stop())) - -TEST_IO_STREAM(close, "Make sure a stream can be closed", ASSERT_OK(closeStream())) -TEST_IO_STREAM(closeTwice, "Make sure a stream can not be closed twice", ASSERT_OK(closeStream()); - ASSERT_RESULT(Result::INVALID_STATE, closeStream())) - -static void testCreateTooBigMmapBuffer(IStream* stream) { - MmapBufferInfo info; - Result res; - // Assume that int max is a value too big to be allocated - // This is true currently with a 32bit media server, but might not when it - // will run in 64 bit - auto minSizeFrames = std::numeric_limits::max(); - ASSERT_OK(stream->createMmapBuffer(minSizeFrames, returnIn(res, info))); - ASSERT_RESULT(invalidArgsOrNotSupported, res); -} - -TEST_IO_STREAM(CreateTooBigMmapBuffer, "Create mmap buffer too big should fail", - testCreateTooBigMmapBuffer(stream.get())) - -static void testGetMmapPositionOfNonMmapedStream(IStream* stream) { - Result res; - MmapPosition position; - ASSERT_OK(stream->getMmapPosition(returnIn(res, position))); - ASSERT_RESULT(invalidArgsOrNotSupported, res); -} - -TEST_IO_STREAM(GetMmapPositionOfNonMmapedStream, - "Retrieving the mmap position of a non mmaped stream should fail", - testGetMmapPositionOfNonMmapedStream(stream.get())) - -////////////////////////////////////////////////////////////////////////////// -///////////////////////////////// StreamIn /////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -TEST_P(InputStreamTest, GetAudioSource) { - doc::test("Retrieving the audio source of an input stream should always succeed"); - AudioSource source; - ASSERT_OK(stream->getAudioSource(returnIn(res, source))); - if (res == Result::NOT_SUPPORTED) { - doc::partialTest("getAudioSource is not supported"); - return; - } - ASSERT_OK(res); - ASSERT_EQ(AudioSource::DEFAULT, source); -} - -static void testUnitaryGain(std::function(float)> setGain) { - for (float value : (float[]){-INFINITY, -1.0, 1.0 + std::numeric_limits::epsilon(), 2.0, - INFINITY, NAN}) { - EXPECT_RESULT(Result::INVALID_ARGUMENTS, setGain(value)) << "value=" << value; - } - // Do not consider -0.0 as an invalid value as it is == with 0.0 - for (float value : {-0.0, 0.0, 0.01, 0.5, 0.09, 1.0 /* Restore volume*/}) { - EXPECT_OK(setGain(value)) << "value=" << value; - } -} - -static void testOptionalUnitaryGain(std::function(float)> setGain, - string debugName) { - auto result = setGain(1); - ASSERT_IS_OK(result); - if (result == Result::NOT_SUPPORTED) { - doc::partialTest(debugName + " is not supported"); - return; - } - testUnitaryGain(setGain); -} - -TEST_P(InputStreamTest, SetGain) { - doc::test("The gain of an input stream should only be set between [0,1]"); - testOptionalUnitaryGain([this](float volume) { return stream->setGain(volume); }, - "InputStream::setGain"); -} - -static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize, uint32_t framesCount) { - Result res; - // Ignore output parameters as the call should fail - ASSERT_OK(stream->prepareForReading(frameSize, framesCount, - [&res](auto r, auto&, auto&, auto&, auto&) { res = r; })); - EXPECT_RESULT(Result::INVALID_ARGUMENTS, res); -} - -TEST_P(InputStreamTest, PrepareForReadingWithZeroBuffer) { - doc::test("Preparing a stream for reading with a 0 sized buffer should fail"); - testPrepareForReading(stream.get(), 0, 0); -} - -TEST_P(InputStreamTest, PrepareForReadingWithHugeBuffer) { - doc::test("Preparing a stream for reading with a 2^32 sized buffer should fail"); - testPrepareForReading(stream.get(), 1, std::numeric_limits::max()); -} - -TEST_P(InputStreamTest, PrepareForReadingCheckOverflow) { - doc::test( - "Preparing a stream for reading with a overflowing sized buffer should " - "fail"); - auto uintMax = std::numeric_limits::max(); - testPrepareForReading(stream.get(), uintMax, uintMax); -} - -TEST_P(InputStreamTest, GetInputFramesLost) { - doc::test("The number of frames lost on a never started stream should be 0"); - auto ret = stream->getInputFramesLost(); - ASSERT_IS_OK(ret); - uint32_t framesLost{ret}; - ASSERT_EQ(0U, framesLost); -} - -TEST_P(InputStreamTest, getCapturePosition) { - doc::test( - "The capture position of a non prepared stream should not be " - "retrievable or 0"); - uint64_t frames; - uint64_t time; - ASSERT_OK(stream->getCapturePosition(returnIn(res, frames, time))); - ASSERT_RESULT(okOrInvalidStateOrNotSupported, res); - if (res == Result::OK) { - ASSERT_EQ(0U, frames); - ASSERT_LE(0U, time); - } -} - -////////////////////////////////////////////////////////////////////////////// -///////////////////////////////// StreamOut ////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -TEST_P(OutputStreamTest, getLatency) { - doc::test("Make sure latency is over 0"); - auto result = stream->getLatency(); - ASSERT_IS_OK(result); - ASSERT_GT(result, 0U); -} - -TEST_P(OutputStreamTest, setVolume) { - doc::test("Try to set the output volume"); - testOptionalUnitaryGain([this](float volume) { return stream->setVolume(volume, volume); }, - "setVolume"); -} - -static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize, uint32_t framesCount) { - Result res; - // Ignore output parameters as the call should fail - ASSERT_OK(stream->prepareForWriting(frameSize, framesCount, - [&res](auto r, auto&, auto&, auto&, auto&) { res = r; })); - EXPECT_RESULT(Result::INVALID_ARGUMENTS, res); -} - -TEST_P(OutputStreamTest, PrepareForWriteWithZeroBuffer) { - doc::test("Preparing a stream for writing with a 0 sized buffer should fail"); - testPrepareForWriting(stream.get(), 0, 0); -} - -TEST_P(OutputStreamTest, PrepareForWriteWithHugeBuffer) { - doc::test("Preparing a stream for writing with a 2^32 sized buffer should fail"); - testPrepareForWriting(stream.get(), 1, std::numeric_limits::max()); -} - -TEST_P(OutputStreamTest, PrepareForWritingCheckOverflow) { - doc::test( - "Preparing a stream for writing with a overflowing sized buffer should " - "fail"); - auto uintMax = std::numeric_limits::max(); - testPrepareForWriting(stream.get(), uintMax, uintMax); -} - -struct Capability { - Capability(IStreamOut* stream) { - EXPECT_OK(stream->supportsPauseAndResume(returnIn(pause, resume))); - auto ret = stream->supportsDrain(); - EXPECT_IS_OK(ret); - if (ret.isOk()) { - drain = ret; - } - } - bool pause = false; - bool resume = false; - bool drain = false; -}; - -TEST_P(OutputStreamTest, SupportsPauseAndResumeAndDrain) { - doc::test("Implementation must expose pause, resume and drain capabilities"); - Capability(stream.get()); -} - -template -static void checkInvalidStateOr0(Result res, Value value) { - switch (res) { - case Result::INVALID_STATE: - break; - case Result::OK: - ASSERT_EQ(0U, value); - break; - default: - FAIL() << "Unexpected result " << toString(res); - } -} - -TEST_P(OutputStreamTest, GetRenderPosition) { - doc::test("A new stream render position should be 0 or INVALID_STATE"); - uint32_t dspFrames; - ASSERT_OK(stream->getRenderPosition(returnIn(res, dspFrames))); - if (res == Result::NOT_SUPPORTED) { - doc::partialTest("getRenderPosition is not supported"); - return; - } - checkInvalidStateOr0(res, dspFrames); -} - -TEST_P(OutputStreamTest, GetNextWriteTimestamp) { - doc::test("A new stream next write timestamp should be 0 or INVALID_STATE"); - uint64_t timestampUs; - ASSERT_OK(stream->getNextWriteTimestamp(returnIn(res, timestampUs))); - if (res == Result::NOT_SUPPORTED) { - doc::partialTest("getNextWriteTimestamp is not supported"); - return; - } - checkInvalidStateOr0(res, timestampUs); -} - -/** Stub implementation of out stream callback. */ -class MockOutCallbacks : public IStreamOutCallback { - Return onWriteReady() override { return {}; } - Return onDrainReady() override { return {}; } - Return onError() override { return {}; } -}; - -static bool isAsyncModeSupported(IStreamOut* stream) { - auto res = stream->setCallback(new MockOutCallbacks); - stream->clearCallback(); // try to restore the no callback state, ignore - // any error - EXPECT_RESULT(okOrNotSupported, res); - return res.isOk() ? res == Result::OK : false; -} - -TEST_P(OutputStreamTest, SetCallback) { - doc::test( - "If supported, registering callback for async operation should never " - "fail"); - if (!isAsyncModeSupported(stream.get())) { - doc::partialTest("The stream does not support async operations"); - return; - } - ASSERT_OK(stream->setCallback(new MockOutCallbacks)); - ASSERT_OK(stream->setCallback(new MockOutCallbacks)); -} - -TEST_P(OutputStreamTest, clearCallback) { - doc::test( - "If supported, clearing a callback to go back to sync operation should " - "not fail"); - if (!isAsyncModeSupported(stream.get())) { - doc::partialTest("The stream does not support async operations"); - return; - } - // TODO: Clarify if clearing a non existing callback should fail - ASSERT_OK(stream->setCallback(new MockOutCallbacks)); - ASSERT_OK(stream->clearCallback()); -} - -TEST_P(OutputStreamTest, Resume) { - doc::test( - "If supported, a stream should fail to resume if not previously " - "paused"); - if (!Capability(stream.get()).resume) { - doc::partialTest("The output stream does not support resume"); - return; - } - ASSERT_RESULT(Result::INVALID_STATE, stream->resume()); -} - -TEST_P(OutputStreamTest, Pause) { - doc::test( - "If supported, a stream should fail to pause if not previously " - "started"); - if (!Capability(stream.get()).pause) { - doc::partialTest("The output stream does not support pause"); - return; - } - ASSERT_RESULT(Result::INVALID_STATE, stream->pause()); -} - -static void testDrain(IStreamOut* stream, AudioDrain type) { - if (!Capability(stream).drain) { - doc::partialTest("The output stream does not support drain"); - return; - } - ASSERT_RESULT(Result::OK, stream->drain(type)); -} - -TEST_P(OutputStreamTest, DrainAll) { - doc::test("If supported, a stream should always succeed to drain"); - testDrain(stream.get(), AudioDrain::ALL); -} - -TEST_P(OutputStreamTest, DrainEarlyNotify) { - doc::test("If supported, a stream should always succeed to drain"); - testDrain(stream.get(), AudioDrain::EARLY_NOTIFY); -} - -TEST_P(OutputStreamTest, FlushStop) { - doc::test("If supported, a stream should always succeed to flush"); - auto ret = stream->flush(); - ASSERT_IS_OK(ret); - if (ret == Result::NOT_SUPPORTED) { - doc::partialTest("Flush is not supported"); - return; - } - ASSERT_OK(ret); -} - -TEST_P(OutputStreamTest, GetPresentationPositionStop) { - doc::test( - "If supported, a stream should always succeed to retrieve the " - "presentation position"); - uint64_t frames; - TimeSpec mesureTS; - ASSERT_OK(stream->getPresentationPosition(returnIn(res, frames, mesureTS))); - if (res == Result::NOT_SUPPORTED) { - doc::partialTest("getpresentationPosition is not supported"); - return; - } - ASSERT_EQ(0U, frames); - - if (mesureTS.tvNSec == 0 && mesureTS.tvSec == 0) { - // As the stream has never written a frame yet, - // the timestamp does not really have a meaning, allow to return 0 - return; - } - - // Make sure the return measure is not more than 1s old. - struct timespec currentTS; - ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, ¤tTS)) << errno; - - auto toMicroSec = [](uint64_t sec, auto nsec) { return sec * 1e+6 + nsec / 1e+3; }; - auto currentTime = toMicroSec(currentTS.tv_sec, currentTS.tv_nsec); - auto mesureTime = toMicroSec(mesureTS.tvSec, mesureTS.tvNSec); - ASSERT_PRED2([](auto c, auto m) { return c - m < 1e+6; }, currentTime, mesureTime); -} - -////////////////////////////////////////////////////////////////////////////// -/////////////////////////////// PrimaryDevice //////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -TEST_F(AudioPrimaryHidlTest, setVoiceVolume) { - doc::test("Make sure setVoiceVolume only succeed if volume is in [0,1]"); - testUnitaryGain([](float volume) { return device->setVoiceVolume(volume); }); -} - -TEST_F(BoolAccessorPrimaryHidlTest, BtScoNrecEnabled) { - doc::test("Query and set the BT SCO NR&EC state"); - testAccessors("BtScoNrecEnabled", Initial{false, OPTIONAL}, {true}, - &IPrimaryDevice::setBtScoNrecEnabled, - &IPrimaryDevice::getBtScoNrecEnabled); -} - -TEST_F(BoolAccessorPrimaryHidlTest, setGetBtScoWidebandEnabled) { - doc::test("Query and set the SCO whideband state"); - testAccessors("BtScoWideband", Initial{false, OPTIONAL}, {true}, - &IPrimaryDevice::setBtScoWidebandEnabled, - &IPrimaryDevice::getBtScoWidebandEnabled); -} - -using TtyModeAccessorPrimaryHidlTest = AccessorPrimaryHidlTest; -TEST_F(TtyModeAccessorPrimaryHidlTest, setGetTtyMode) { - doc::test("Query and set the TTY mode state"); - testAccessors("TTY mode", Initial{TtyMode::OFF}, - {TtyMode::HCO, TtyMode::VCO, TtyMode::FULL}, - &IPrimaryDevice::setTtyMode, &IPrimaryDevice::getTtyMode); -} - -TEST_F(BoolAccessorPrimaryHidlTest, setGetHac) { - doc::test("Query and set the HAC state"); - testAccessors("HAC", Initial{false}, {true}, &IPrimaryDevice::setHacEnabled, - &IPrimaryDevice::getHacEnabled); -} - -////////////////////////////////////////////////////////////////////////////// -//////////////////// Clean caches on global tear down //////////////////////// -////////////////////////////////////////////////////////////////////////////// - -int main(int argc, char** argv) { - environment = new AudioHidlTestEnvironment; - ::testing::AddGlobalTestEnvironment(environment); - ::testing::InitGoogleTest(&argc, argv); - environment->init(&argc, argv); - int status = RUN_ALL_TESTS(); - return status; -} diff --git a/audio/core/all-versions/OWNERS b/audio/core/all-versions/OWNERS deleted file mode 100644 index 6fdc97ca29..0000000000 --- a/audio/core/all-versions/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -elaurent@google.com -krocard@google.com -mnaganov@google.com diff --git a/audio/core/all-versions/default/Android.bp b/audio/core/all-versions/default/Android.bp index bb02863ba6..9c065103e9 100644 --- a/audio/core/all-versions/default/Android.bp +++ b/audio/core/all-versions/default/Android.bp @@ -1,7 +1,18 @@ -cc_library_headers { - name: "android.hardware.audio.core@all-versions-impl", +cc_library_shared { + name: "android.hardware.audio@2.0-impl", relative_install_path: "hw", + proprietary: true, vendor: true, + srcs: [ + "Conversions.cpp", + "Device.cpp", + "DevicesFactory.cpp", + "ParametersUtil.cpp", + "PrimaryDevice.cpp", + "Stream.cpp", + "StreamIn.cpp", + "StreamOut.cpp", + ], defaults: ["hidl_defaults"], @@ -16,14 +27,81 @@ cc_library_headers { "libhidltransport", "liblog", "libutils", + "android.hardware.audio@2.0", + "android.hardware.audio.common@2.0", + "android.hardware.audio.common@2.0-util", "android.hardware.audio.common-util", ], header_libs: [ + "android.hardware.audio.common.util@all-versions", "libaudioclient_headers", "libaudio_system_headers", "libhardware_headers", "libmedia_headers", - "android.hardware.audio.common.util@all-versions", ], + + whole_static_libs: [ + "libmedia_helper", + ], + + cflags: [ + "-DMAJOR_VERSION=2", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] +} + +cc_library_shared { + name: "android.hardware.audio@4.0-impl", + relative_install_path: "hw", + proprietary: true, + vendor: true, + srcs: [ + "Conversions.cpp", + "Device.cpp", + "DevicesFactory.cpp", + "ParametersUtil.cpp", + "PrimaryDevice.cpp", + "Stream.cpp", + "StreamIn.cpp", + "StreamOut.cpp", + ], + + defaults: ["hidl_defaults"], + + export_include_dirs: ["include"], + + shared_libs: [ + "libbase", + "libcutils", + "libfmq", + "libhardware", + "libhidlbase", + "libhidltransport", + "liblog", + "libutils", + "android.hardware.audio@4.0", + "android.hardware.audio.common@4.0", + "android.hardware.audio.common@4.0-util", + "android.hardware.audio.common-util", + ], + + header_libs: [ + "android.hardware.audio.common.util@all-versions", + "libaudioclient_headers", + "libaudio_system_headers", + "libhardware_headers", + "libmedia_headers", + ], + + whole_static_libs: [ + "libmedia_helper", + ], + + cflags: [ + "-DMAJOR_VERSION=4", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] } diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Conversions.impl.h b/audio/core/all-versions/default/Conversions.cpp similarity index 96% rename from audio/core/all-versions/default/include/core/all-versions/default/Conversions.impl.h rename to audio/core/all-versions/default/Conversions.cpp index 5828c3f373..7ce0c59d18 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/Conversions.impl.h +++ b/audio/core/all-versions/default/Conversions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include "core/default/Conversions.h" #include @@ -23,10 +23,10 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; std::string deviceAddressToHal(const DeviceAddress& address) { // HAL assumes that the address is NUL-terminated. @@ -58,7 +58,7 @@ std::string deviceAddressToHal(const DeviceAddress& address) { return halAddress; } -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 status_t deviceAddressFromHal(audio_devices_t device, const char* halAddress, DeviceAddress* address) { if (address == nullptr) { @@ -188,7 +188,7 @@ bool halToMicrophoneCharacteristics(MicrophoneInfo* pDst, #endif } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h b/audio/core/all-versions/default/Device.cpp similarity index 95% rename from audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h rename to audio/core/all-versions/default/Device.cpp index 52d21869dd..b2bd4053c8 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h +++ b/audio/core/all-versions/default/Device.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,14 @@ * limitations under the License. */ -#include +#define LOG_TAG "DeviceHAL" + +#include "core/default/Device.h" +#include +#include "core/default/Conversions.h" +#include "core/default/StreamIn.h" +#include "core/default/StreamOut.h" +#include "core/default/Util.h" //#define LOG_NDEBUG 0 @@ -24,12 +31,12 @@ #include -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils; +using ::android::hardware::audio::common::CPP_VERSION::HidlUtils; namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { Device::Device(audio_hw_device_t* device) : mDevice(device) {} @@ -61,7 +68,7 @@ int Device::halSetParameters(const char* keysAndValues) { return mDevice->set_parameters(mDevice, keysAndValues); } -// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow. +// Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow. Return Device::initCheck() { return analyzeStatus("init_check", mDevice->init_check(mDevice)); } @@ -132,7 +139,7 @@ Return Device::getInputBufferSize(const AudioConfig& config, getInputBuffe Return Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioOutputFlagBitfield flags, -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 const SourceMetadata& /* sourceMetadata */, #endif openOutputStream_cb _hidl_cb) { @@ -190,7 +197,7 @@ Return Device::openInputStream(int32_t ioHandle, const DeviceAddress& devi return Void(); } -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 Return Device::openInputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioInputFlagBitfield flags, const SinkMetadata& sinkMetadata, @@ -263,13 +270,13 @@ Return Device::setAudioPortConfig(const AudioPortConfig& config) { return Result::NOT_SUPPORTED; } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return Device::getHwAvSync() { int halHwAvSync; Result retval = getParam(AudioParameter::keyHwAvSync, &halHwAvSync); return retval == Result::OK ? halHwAvSync : AUDIO_HW_SYNC_INVALID; } -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return Device::getHwAvSync(getHwAvSync_cb _hidl_cb) { int halHwAvSync; Result retval = getParam(AudioParameter::keyHwAvSync, &halHwAvSync); @@ -282,7 +289,7 @@ Return Device::setScreenState(bool turnedOn) { return setParam(AudioParameter::keyScreenState, turnedOn); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return Device::getParameters(const hidl_vec& keys, getParameters_cb _hidl_cb) { getParametersImpl({}, keys, _hidl_cb); return Void(); @@ -291,7 +298,7 @@ Return Device::getParameters(const hidl_vec& keys, getParamet Return Device::setParameters(const hidl_vec& parameters) { return setParametersImpl({} /* context */, parameters); } -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return Device::getParameters(const hidl_vec& context, const hidl_vec& keys, getParameters_cb _hidl_cb) { getParametersImpl(context, keys, _hidl_cb); @@ -303,7 +310,7 @@ Return Device::setParameters(const hidl_vec& context, } #endif -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return Device::debugDump(const hidl_handle& fd) { return debug(fd, {}); } @@ -316,7 +323,7 @@ Return Device::debug(const hidl_handle& fd, const hidl_vec& / return Void(); } -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 Return Device::getMicrophones(getMicrophones_cb _hidl_cb) { Result retval = Result::NOT_SUPPORTED; size_t actual_mics = AUDIO_MICROPHONE_MAX_COUNT; @@ -342,7 +349,7 @@ Return Device::setConnectedState(const DeviceAddress& address, bool conn #endif } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.impl.h b/audio/core/all-versions/default/DevicesFactory.cpp similarity index 92% rename from audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.impl.h rename to audio/core/all-versions/default/DevicesFactory.cpp index a9f59fbfec..67fc5d3ead 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.impl.h +++ b/audio/core/all-versions/default/DevicesFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,11 @@ * limitations under the License. */ -#include +#define LOG_TAG "DevicesFactoryHAL" + +#include "core/default/DevicesFactory.h" +#include "core/default/Device.h" +#include "core/default/PrimaryDevice.h" #include @@ -23,10 +27,10 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return DevicesFactory::openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) { switch (device) { case IDevicesFactory::Device::PRIMARY: @@ -43,8 +47,7 @@ Return DevicesFactory::openDevice(IDevicesFactory::Device device, openDevi _hidl_cb(Result::INVALID_ARGUMENTS, nullptr); return Void(); } -#endif -#ifdef AUDIO_HAL_VERSION_4_0 +#elif MAJOR_VERSION == 4 Return DevicesFactory::openDevice(const hidl_string& moduleName, openDevice_cb _hidl_cb) { if (moduleName == AUDIO_HARDWARE_MODULE_ID_PRIMARY) { return openDevice(moduleName.c_str(), _hidl_cb); @@ -111,7 +114,7 @@ IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/common/4.0/default/OWNERS b/audio/core/all-versions/default/OWNERS similarity index 100% rename from audio/common/4.0/default/OWNERS rename to audio/core/all-versions/default/OWNERS diff --git a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h b/audio/core/all-versions/default/ParametersUtil.cpp similarity index 96% rename from audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h rename to audio/core/all-versions/default/ParametersUtil.cpp index 39bd66a787..0c8e28af8b 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h +++ b/audio/core/all-versions/default/ParametersUtil.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,13 +14,16 @@ * limitations under the License. */ -#include +#include "core/default/ParametersUtil.h" +#include "core/default/Conversions.h" +#include "core/default/Util.h" + #include namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { /** Converts a status_t in Result according to the rules of AudioParameter::get* @@ -158,7 +161,7 @@ Result ParametersUtil::setParams(const AudioParameter& param) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.impl.h b/audio/core/all-versions/default/PrimaryDevice.cpp similarity index 95% rename from audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.impl.h rename to audio/core/all-versions/default/PrimaryDevice.cpp index f269dd4f91..ff0fecc740 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.impl.h +++ b/audio/core/all-versions/default/PrimaryDevice.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,23 +14,26 @@ * limitations under the License. */ -#include +#define LOG_TAG "PrimaryDeviceHAL" -#ifdef AUDIO_HAL_VERSION_4_0 +#include "core/default/PrimaryDevice.h" +#include "core/default/Util.h" + +#if MAJOR_VERSION == 4 #include #endif namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { PrimaryDevice::PrimaryDevice(audio_hw_device_t* device) : mDevice(new Device(device)) {} PrimaryDevice::~PrimaryDevice() {} -// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow. +// Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow. Return PrimaryDevice::initCheck() { return mDevice->initCheck(); } @@ -64,7 +67,7 @@ Return PrimaryDevice::getInputBufferSize(const AudioConfig& config, return mDevice->getInputBufferSize(config, _hidl_cb); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return PrimaryDevice::openOutputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioOutputFlagBitfield flags, @@ -77,7 +80,7 @@ Return PrimaryDevice::openInputStream(int32_t ioHandle, const DeviceAddres AudioSource source, openInputStream_cb _hidl_cb) { return mDevice->openInputStream(ioHandle, device, config, flags, source, _hidl_cb); } -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return PrimaryDevice::openOutputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioOutputFlagBitfield flags, @@ -120,7 +123,7 @@ Return PrimaryDevice::setScreenState(bool turnedOn) { return mDevice->setScreenState(turnedOn); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return PrimaryDevice::getHwAvSync() { return mDevice->getHwAvSync(); } @@ -137,7 +140,7 @@ Return PrimaryDevice::setParameters(const hidl_vec& para Return PrimaryDevice::debugDump(const hidl_handle& fd) { return mDevice->debugDump(fd); } -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return PrimaryDevice::getHwAvSync(getHwAvSync_cb _hidl_cb) { return mDevice->getHwAvSync(_hidl_cb); } @@ -158,7 +161,7 @@ Return PrimaryDevice::setConnectedState(const DeviceAddress& address, bo } #endif -// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow. +// Methods from ::android::hardware::audio::CPP_VERSION::IPrimaryDevice follow. Return PrimaryDevice::setVoiceVolume(float volume) { if (!isGainNormalized(volume)) { ALOGW("Can not set a voice volume (%f) outside [0,1]", volume); @@ -271,7 +274,7 @@ Return PrimaryDevice::setHacEnabled(bool enabled) { return mDevice->setParam(AUDIO_PARAMETER_KEY_HAC, enabled); } -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 Return PrimaryDevice::setBtScoHeadsetDebugName(const hidl_string& name) { return mDevice->setParam(AUDIO_PARAMETER_KEY_BT_SCO_HEADSET_NAME, name.c_str()); } @@ -307,7 +310,7 @@ Return PrimaryDevice::debug(const hidl_handle& fd, const hidl_vec +#define LOG_TAG "StreamHAL" + +#include "core/default/Stream.h" +#include "common/all-versions/default/EffectMap.h" +#include "core/default/Conversions.h" +#include "core/default/Util.h" #include @@ -28,7 +33,7 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { Stream::Stream(audio_stream_t* stream) : mStream(stream) {} @@ -56,7 +61,7 @@ int Stream::halSetParameters(const char* keysAndValues) { return mStream->set_parameters(mStream, keysAndValues); } -// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. +// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow. Return Stream::getFrameSize() { // Needs to be implemented by interface subclasses. But can't be declared as pure virtual, // since interface subclasses implementation do not inherit from this class. @@ -78,7 +83,7 @@ Return Stream::getSampleRate() { return mStream->get_sample_rate(mStream); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return Stream::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) { return getSupportedSampleRates(getFormat(), _hidl_cb); } @@ -106,9 +111,9 @@ Return Stream::getSupportedSampleRates(AudioFormat format, result = Result::NOT_SUPPORTED; } } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 _hidl_cb(sampleRates); -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 _hidl_cb(result, sampleRates); #endif return Void(); @@ -135,9 +140,9 @@ Return Stream::getSupportedChannelMasks(AudioFormat format, result = Result::NOT_SUPPORTED; } } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 _hidl_cb(channelMasks); -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 _hidl_cb(result, channelMasks); #endif return Void(); @@ -216,7 +221,7 @@ Return Stream::setHwAvSync(uint32_t hwAvSync) { return setParam(AudioParameter::keyStreamHwAvSync, static_cast(hwAvSync)); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return Stream::getDevice() { int device = 0; Result retval = getParam(AudioParameter::keyRouting, &device); @@ -241,7 +246,7 @@ Return Stream::setConnectedState(const DeviceAddress& address, bool conn connected ? AudioParameter::keyStreamConnect : AudioParameter::keyStreamDisconnect, address); } -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return Stream::getDevices(getDevices_cb _hidl_cb) { int device = 0; Result retval = getParam(AudioParameter::keyRouting, &device); @@ -313,14 +318,14 @@ Return Stream::debug(const hidl_handle& fd, const hidl_vec& / return Void(); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return Stream::debugDump(const hidl_handle& fd) { return debug(fd, {} /* options */); } #endif } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h b/audio/core/all-versions/default/StreamIn.cpp similarity index 96% rename from audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h rename to audio/core/all-versions/default/StreamIn.cpp index 4eb4ef9314..d19526a1dd 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h +++ b/audio/core/all-versions/default/StreamIn.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,11 @@ * limitations under the License. */ -#include +#define LOG_TAG "StreamInHAL" + +#include "core/default/StreamIn.h" +#include "core/default/Conversions.h" +#include "core/default/Util.h" //#define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_AUDIO @@ -24,13 +28,13 @@ #include #include -using ::android::hardware::audio::AUDIO_HAL_VERSION::MessageQueueFlagBits; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo; +using ::android::hardware::audio::common::CPP_VERSION::ThreadInfo; +using ::android::hardware::audio::CPP_VERSION::MessageQueueFlagBits; namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { namespace { @@ -160,7 +164,7 @@ StreamIn::~StreamIn() { mStream = nullptr; } -// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. +// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow. Return StreamIn::getFrameSize() { return audio_stream_in_frame_size(mStream); } @@ -177,7 +181,7 @@ Return StreamIn::getSampleRate() { return mStreamCommon->getSampleRate(); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return StreamIn::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) { return mStreamCommon->getSupportedChannelMasks(_hidl_cb); } @@ -239,7 +243,7 @@ Return StreamIn::setHwAvSync(uint32_t hwAvSync) { return mStreamCommon->setHwAvSync(hwAvSync); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return StreamIn::setConnectedState(const DeviceAddress& address, bool connected) { return mStreamCommon->setConnectedState(address, connected); } @@ -263,7 +267,7 @@ Return StreamIn::setParameters(const hidl_vec& parameter Return StreamIn::debugDump(const hidl_handle& fd) { return mStreamCommon->debugDump(fd); } -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return StreamIn::getDevices(getDevices_cb _hidl_cb) { return mStreamCommon->getDevices(_hidl_cb); } @@ -311,7 +315,7 @@ Return StreamIn::close() { return Result::OK; } -// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow. +// Methods from ::android::hardware::audio::CPP_VERSION::IStreamIn follow. Return StreamIn::getAudioSource(getAudioSource_cb _hidl_cb) { int halSource; Result retval = mStreamCommon->getParam(AudioParameter::keyInputSource, &halSource); @@ -445,7 +449,7 @@ Return StreamIn::debug(const hidl_handle& fd, const hidl_vec& return mStreamCommon->debug(fd, options); } -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 Return StreamIn::updateSinkMetadata(const SinkMetadata& sinkMetadata) { if (mStream->update_sink_metadata == nullptr) { return Void(); // not supported by the HAL @@ -485,7 +489,7 @@ Return StreamIn::getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) { #endif } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/include/core/all-versions/default/StreamOut.impl.h b/audio/core/all-versions/default/StreamOut.cpp similarity index 97% rename from audio/core/all-versions/default/include/core/all-versions/default/StreamOut.impl.h rename to audio/core/all-versions/default/StreamOut.cpp index da0a12f5a6..4ae0fb19c1 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/StreamOut.impl.h +++ b/audio/core/all-versions/default/StreamOut.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,10 @@ * limitations under the License. */ -#include +#define LOG_TAG "StreamOutHAL" + +#include "core/default/StreamOut.h" +#include "core/default/Util.h" //#define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_AUDIO @@ -28,10 +31,10 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo; +using ::android::hardware::audio::common::CPP_VERSION::ThreadInfo; namespace { @@ -165,7 +168,7 @@ StreamOut::~StreamOut() { mStream = nullptr; } -// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. +// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow. Return StreamOut::getFrameSize() { return audio_stream_out_frame_size(mStream); } @@ -182,7 +185,7 @@ Return StreamOut::getSampleRate() { return mStreamCommon->getSampleRate(); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return StreamOut::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) { return mStreamCommon->getSupportedChannelMasks(_hidl_cb); } @@ -244,7 +247,7 @@ Return StreamOut::setHwAvSync(uint32_t hwAvSync) { return mStreamCommon->setHwAvSync(hwAvSync); } -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return StreamOut::setConnectedState(const DeviceAddress& address, bool connected) { return mStreamCommon->setConnectedState(address, connected); } @@ -269,7 +272,7 @@ Return StreamOut::setParameters(const hidl_vec& paramete Return StreamOut::debugDump(const hidl_handle& fd) { return mStreamCommon->debugDump(fd); } -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return StreamOut::getDevices(getDevices_cb _hidl_cb) { return mStreamCommon->getDevices(_hidl_cb); } @@ -301,7 +304,7 @@ Return StreamOut::close() { return Result::OK; } -// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow. +// Methods from ::android::hardware::audio::CPP_VERSION::IStreamOut follow. Return StreamOut::getLatency() { return mStream->get_latency(mStream); } @@ -544,7 +547,7 @@ Return StreamOut::debug(const hidl_handle& fd, const hidl_vec return mStreamCommon->debug(fd, options); } -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 Return StreamOut::updateSourceMetadata(const SourceMetadata& sourceMetadata) { if (mStream->update_source_metadata == nullptr) { return Void(); // not supported by the HAL @@ -571,7 +574,7 @@ Return StreamOut::selectPresentation(int32_t /*presentationId*/, int32_t #endif } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Conversions.h b/audio/core/all-versions/default/include/core/default/Conversions.h similarity index 72% rename from audio/core/all-versions/default/include/core/all-versions/default/Conversions.h rename to audio/core/all-versions/default/include/core/default/Conversions.h index b38eca35a1..f843450fc7 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/Conversions.h +++ b/audio/core/all-versions/default/include/core/default/Conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,10 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_CONVERSIONS_H_ +#define ANDROID_HARDWARE_AUDIO_CONVERSIONS_H_ + +#include PATH(android/hardware/audio/FILE_VERSION/types.h) #include @@ -23,20 +26,22 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; +using ::android::hardware::audio::CPP_VERSION::DeviceAddress; std::string deviceAddressToHal(const DeviceAddress& address); -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 bool halToMicrophoneCharacteristics(MicrophoneInfo* pDst, const struct audio_microphone_characteristic_t& src); #endif } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_CONVERSIONS_H_ diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Device.h b/audio/core/all-versions/default/include/core/default/Device.h similarity index 74% rename from audio/core/all-versions/default/include/core/all-versions/default/Device.h rename to audio/core/all-versions/default/include/core/default/Device.h index c627145560..b92b90afc3 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/Device.h +++ b/audio/core/all-versions/default/include/core/default/Device.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_DEVICE_H +#define ANDROID_HARDWARE_AUDIO_DEVICE_H + +#include PATH(android/hardware/audio/FILE_VERSION/IDevice.h) + +#include "ParametersUtil.h" #include @@ -30,7 +35,7 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -38,33 +43,32 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut; -using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; -using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioHwSync; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPatchHandle; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioInputFlagBitfield; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation:: - AudioOutputFlagBitfield; +using ::android::hardware::audio::common::CPP_VERSION::AudioConfig; +using ::android::hardware::audio::common::CPP_VERSION::AudioHwSync; +using ::android::hardware::audio::common::CPP_VERSION::AudioInputFlag; +using ::android::hardware::audio::common::CPP_VERSION::AudioOutputFlag; +using ::android::hardware::audio::common::CPP_VERSION::AudioPatchHandle; +using ::android::hardware::audio::common::CPP_VERSION::AudioPort; +using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfig; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioInputFlagBitfield; +using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioOutputFlagBitfield; +using ::android::hardware::audio::CPP_VERSION::DeviceAddress; +using ::android::hardware::audio::CPP_VERSION::IDevice; +using ::android::hardware::audio::CPP_VERSION::IStreamIn; +using ::android::hardware::audio::CPP_VERSION::IStreamOut; +using ::android::hardware::audio::CPP_VERSION::ParameterValue; +using ::android::hardware::audio::CPP_VERSION::Result; -#ifdef AUDIO_HAL_VERSION_4_0 -using ::android::hardware::audio::AUDIO_HAL_VERSION::SinkMetadata; -using ::android::hardware::audio::AUDIO_HAL_VERSION::SourceMetadata; +#if MAJOR_VERSION == 4 +using ::android::hardware::audio::CPP_VERSION::SinkMetadata; +using ::android::hardware::audio::CPP_VERSION::SourceMetadata; #endif struct Device : public IDevice, public ParametersUtil { explicit Device(audio_hw_device_t* device); - // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow. + // Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow. Return initCheck() override; Return setMasterVolume(float volume) override; Return getMasterVolume(getMasterVolume_cb _hidl_cb) override; @@ -79,11 +83,11 @@ struct Device : public IDevice, public ParametersUtil { Return openInputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioInputFlagBitfield flags, AudioSource source, openInputStream_cb _hidl_cb); -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return openOutputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioOutputFlagBitfield flags, openOutputStream_cb _hidl_cb) override; -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return openOutputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioOutputFlagBitfield flags, const SourceMetadata& sourceMetadata, @@ -104,13 +108,13 @@ struct Device : public IDevice, public ParametersUtil { Return setScreenState(bool turnedOn) override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return getHwAvSync() override; Return getParameters(const hidl_vec& keys, getParameters_cb _hidl_cb) override; Return setParameters(const hidl_vec& parameters) override; Return debugDump(const hidl_handle& fd) override; -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return getHwAvSync(getHwAvSync_cb _hidl_cb) override; Return getParameters(const hidl_vec& context, const hidl_vec& keys, @@ -143,7 +147,9 @@ struct Device : public IDevice, public ParametersUtil { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_DEVICE_H diff --git a/audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.h b/audio/core/all-versions/default/include/core/default/DevicesFactory.h similarity index 75% rename from audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.h rename to audio/core/all-versions/default/include/core/default/DevicesFactory.h index a2907e0ecc..00c983d01f 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.h +++ b/audio/core/all-versions/default/include/core/default/DevicesFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,10 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_DEVICESFACTORY_H +#define ANDROID_HARDWARE_AUDIO_DEVICESFACTORY_H + +#include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h) #include @@ -24,7 +27,7 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -32,15 +35,14 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory; -using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::CPP_VERSION::IDevice; +using ::android::hardware::audio::CPP_VERSION::IDevicesFactory; +using ::android::hardware::audio::CPP_VERSION::Result; struct DevicesFactory : public IDevicesFactory { -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) override; -#endif -#ifdef AUDIO_HAL_VERSION_4_0 +#elif MAJOR_VERSION == 4 Return openDevice(const hidl_string& device, openDevice_cb _hidl_cb) override; Return openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) override; #endif @@ -56,7 +58,9 @@ struct DevicesFactory : public IDevicesFactory { extern "C" IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name); } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_DEVICESFACTORY_H diff --git a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.h b/audio/core/all-versions/default/include/core/default/ParametersUtil.h similarity index 80% rename from audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.h rename to audio/core/all-versions/default/include/core/default/ParametersUtil.h index 8f16ac29be..ba4ca0c96e 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.h +++ b/audio/core/all-versions/default/include/core/default/ParametersUtil.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,10 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_ +#define ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_ + +#include PATH(android/hardware/audio/FILE_VERSION/types.h) #include #include @@ -25,14 +28,14 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; -using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; -using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; -using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::CPP_VERSION::DeviceAddress; +using ::android::hardware::audio::CPP_VERSION::ParameterValue; +using ::android::hardware::audio::CPP_VERSION::Result; class ParametersUtil { public: @@ -60,7 +63,9 @@ class ParametersUtil { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_ diff --git a/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.h b/audio/core/all-versions/default/include/core/default/PrimaryDevice.h similarity index 77% rename from audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.h rename to audio/core/all-versions/default/include/core/default/PrimaryDevice.h index bb09e5f131..e5aa05b31f 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.h +++ b/audio/core/all-versions/default/include/core/default/PrimaryDevice.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H +#define ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H + +#include PATH(android/hardware/audio/FILE_VERSION/IPrimaryDevice.h) + +#include "Device.h" #include @@ -23,7 +28,7 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -31,25 +36,25 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut; -using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; -using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; +using ::android::hardware::audio::common::CPP_VERSION::AudioConfig; +using ::android::hardware::audio::common::CPP_VERSION::AudioInputFlag; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioOutputFlag; +using ::android::hardware::audio::common::CPP_VERSION::AudioPort; +using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfig; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::CPP_VERSION::DeviceAddress; +using ::android::hardware::audio::CPP_VERSION::IDevice; +using ::android::hardware::audio::CPP_VERSION::IPrimaryDevice; +using ::android::hardware::audio::CPP_VERSION::IStreamIn; +using ::android::hardware::audio::CPP_VERSION::IStreamOut; +using ::android::hardware::audio::CPP_VERSION::ParameterValue; +using ::android::hardware::audio::CPP_VERSION::Result; struct PrimaryDevice : public IPrimaryDevice { explicit PrimaryDevice(audio_hw_device_t* device); - // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow. + // Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow. Return initCheck() override; Return setMasterVolume(float volume) override; Return getMasterVolume(getMasterVolume_cb _hidl_cb) override; @@ -62,7 +67,7 @@ struct PrimaryDevice : public IPrimaryDevice { Return openOutputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioOutputFlagBitfield flags, -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 const SourceMetadata& sourceMetadata, #endif openOutputStream_cb _hidl_cb) override; @@ -70,7 +75,7 @@ struct PrimaryDevice : public IPrimaryDevice { Return openInputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioInputFlagBitfield flags, AudioSource source, openInputStream_cb _hidl_cb); -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 Return openInputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioInputFlagBitfield flags, const SinkMetadata& sinkMetadata, @@ -87,13 +92,13 @@ struct PrimaryDevice : public IPrimaryDevice { Return setScreenState(bool turnedOn) override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return getHwAvSync() override; Return getParameters(const hidl_vec& keys, getParameters_cb _hidl_cb) override; Return setParameters(const hidl_vec& parameters) override; Return debugDump(const hidl_handle& fd) override; -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return getHwAvSync(getHwAvSync_cb _hidl_cb) override; Return getParameters(const hidl_vec& context, const hidl_vec& keys, @@ -106,7 +111,7 @@ struct PrimaryDevice : public IPrimaryDevice { Return debug(const hidl_handle& fd, const hidl_vec& options) override; - // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow. + // Methods from ::android::hardware::audio::CPP_VERSION::IPrimaryDevice follow. Return setVoiceVolume(float volume) override; Return setMode(AudioMode mode) override; Return getBtScoNrecEnabled(getBtScoNrecEnabled_cb _hidl_cb) override; @@ -118,7 +123,7 @@ struct PrimaryDevice : public IPrimaryDevice { Return getHacEnabled(getHacEnabled_cb _hidl_cb) override; Return setHacEnabled(bool enabled) override; -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 Return setBtScoHeadsetDebugName(const hidl_string& name) override; Return getBtHfpEnabled(getBtHfpEnabled_cb _hidl_cb) override; Return setBtHfpEnabled(bool enabled) override; @@ -134,7 +139,9 @@ struct PrimaryDevice : public IPrimaryDevice { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Stream.h b/audio/core/all-versions/default/include/core/default/Stream.h similarity index 88% rename from audio/core/all-versions/default/include/core/all-versions/default/Stream.h rename to audio/core/all-versions/default/include/core/default/Stream.h index 8d6b5303e8..87afa7c855 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/Stream.h +++ b/audio/core/all-versions/default/include/core/default/Stream.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_STREAM_H +#define ANDROID_HARDWARE_AUDIO_STREAM_H + +#include PATH(android/hardware/audio/FILE_VERSION/IStream.h) + +#include "ParametersUtil.h" #include @@ -28,7 +33,7 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -36,14 +41,14 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream; -using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; -using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield; +using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioFormat; +using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield; +using ::android::hardware::audio::CPP_VERSION::DeviceAddress; +using ::android::hardware::audio::CPP_VERSION::IStream; +using ::android::hardware::audio::CPP_VERSION::ParameterValue; +using ::android::hardware::audio::CPP_VERSION::Result; struct Stream : public IStream, public ParametersUtil { explicit Stream(audio_stream_t* stream); @@ -55,12 +60,12 @@ struct Stream : public IStream, public ParametersUtil { */ static constexpr uint32_t MAX_BUFFER_SIZE = 2 << 30 /* == 1GiB */; - // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. + // Methods from ::android::hardware::audio::CPP_VERSION::IStream follow. Return getFrameSize() override; Return getFrameCount() override; Return getBufferSize() override; Return getSampleRate() override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override; Return getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override; #endif @@ -76,14 +81,14 @@ struct Stream : public IStream, public ParametersUtil { Return addEffect(uint64_t effectId) override; Return removeEffect(uint64_t effectId) override; Return standby() override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return getDevice() override; Return setDevice(const DeviceAddress& address) override; Return getParameters(const hidl_vec& keys, getParameters_cb _hidl_cb) override; Return setParameters(const hidl_vec& parameters) override; Return setConnectedState(const DeviceAddress& address, bool connected) override; -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return getDevices(getDevices_cb _hidl_cb) override; Return setDevices(const hidl_vec& devices) override; Return getParameters(const hidl_vec& context, @@ -100,7 +105,7 @@ struct Stream : public IStream, public ParametersUtil { Return close() override; Return debug(const hidl_handle& fd, const hidl_vec& options) override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return debugDump(const hidl_handle& fd) override; #endif @@ -171,7 +176,7 @@ Return StreamMmap::createMmapBuffer(int32_t minSizeFrames, size_t frame halInfo.buffer_size_frames = abs(halInfo.buffer_size_frames); info.sharedMemory = // hidl_memory size must always be positive hidl_memory("audio_buffer", hidlHandle, frameSize * halInfo.buffer_size_frames); -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 if (applicationShareable) { halInfo.buffer_size_frames *= -1; } @@ -210,7 +215,9 @@ Return StreamMmap::getMmapPosition(IStream::getMmapPosition_cb _hidl_cb } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_STREAM_H diff --git a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.h b/audio/core/all-versions/default/include/core/default/StreamIn.h similarity index 81% rename from audio/core/all-versions/default/include/core/all-versions/default/StreamIn.h rename to audio/core/all-versions/default/include/core/default/StreamIn.h index d32b222ab3..52d97eb93f 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.h +++ b/audio/core/all-versions/default/include/core/default/StreamIn.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,13 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_STREAMIN_H +#define ANDROID_HARDWARE_AUDIO_STREAMIN_H + +#include PATH(android/hardware/audio/FILE_VERSION/IStreamIn.h) + +#include "Device.h" +#include "Stream.h" #include #include @@ -28,7 +34,7 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -36,15 +42,15 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn; -using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; -using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; +using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioFormat; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::CPP_VERSION::DeviceAddress; +using ::android::hardware::audio::CPP_VERSION::IStream; +using ::android::hardware::audio::CPP_VERSION::IStreamIn; +using ::android::hardware::audio::CPP_VERSION::ParameterValue; +using ::android::hardware::audio::CPP_VERSION::Result; struct StreamIn : public IStreamIn { typedef MessageQueue CommandMQ; @@ -53,12 +59,12 @@ struct StreamIn : public IStreamIn { StreamIn(const sp& device, audio_stream_in_t* stream); - // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. + // Methods from ::android::hardware::audio::CPP_VERSION::IStream follow. Return getFrameSize() override; Return getFrameCount() override; Return getBufferSize() override; Return getSampleRate() override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override; Return getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override; #endif @@ -74,14 +80,14 @@ struct StreamIn : public IStreamIn { Return addEffect(uint64_t effectId) override; Return removeEffect(uint64_t effectId) override; Return standby() override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return getDevice() override; Return setDevice(const DeviceAddress& address) override; Return getParameters(const hidl_vec& keys, getParameters_cb _hidl_cb) override; Return setParameters(const hidl_vec& parameters) override; Return setConnectedState(const DeviceAddress& address, bool connected) override; -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return getDevices(getDevices_cb _hidl_cb) override; Return setDevices(const hidl_vec& devices) override; Return getParameters(const hidl_vec& context, @@ -94,11 +100,11 @@ struct StreamIn : public IStreamIn { Return close() override; Return debug(const hidl_handle& fd, const hidl_vec& options) override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return debugDump(const hidl_handle& fd) override; #endif - // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow. + // Methods from ::android::hardware::audio::CPP_VERSION::IStreamIn follow. Return getAudioSource(getAudioSource_cb _hidl_cb) override; Return setGain(float gain) override; Return prepareForReading(uint32_t frameSize, uint32_t framesCount, @@ -109,7 +115,7 @@ struct StreamIn : public IStreamIn { Return stop() override; Return createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override; Return getMmapPosition(getMmapPosition_cb _hidl_cb) override; -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 Return updateSinkMetadata(const SinkMetadata& sinkMetadata) override; Return getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) override; #endif @@ -134,7 +140,9 @@ struct StreamIn : public IStreamIn { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_STREAMIN_H diff --git a/audio/core/all-versions/default/include/core/all-versions/default/StreamOut.h b/audio/core/all-versions/default/include/core/default/StreamOut.h similarity index 81% rename from audio/core/all-versions/default/include/core/all-versions/default/StreamOut.h rename to audio/core/all-versions/default/include/core/default/StreamOut.h index af70a59e7a..399766e3af 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/StreamOut.h +++ b/audio/core/all-versions/default/include/core/default/StreamOut.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,13 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_STREAMOUT_H +#define ANDROID_HARDWARE_AUDIO_STREAMOUT_H + +#include PATH(android/hardware/audio/FILE_VERSION/IStreamOut.h) + +#include "Device.h" +#include "Stream.h" #include #include @@ -28,7 +34,7 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -36,17 +42,17 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::AUDIO_HAL_VERSION::AudioDrain; -using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut; -using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOutCallback; -using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; -using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; -using ::android::hardware::audio::AUDIO_HAL_VERSION::TimeSpec; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat; +using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioFormat; +using ::android::hardware::audio::CPP_VERSION::AudioDrain; +using ::android::hardware::audio::CPP_VERSION::DeviceAddress; +using ::android::hardware::audio::CPP_VERSION::IStream; +using ::android::hardware::audio::CPP_VERSION::IStreamOut; +using ::android::hardware::audio::CPP_VERSION::IStreamOutCallback; +using ::android::hardware::audio::CPP_VERSION::ParameterValue; +using ::android::hardware::audio::CPP_VERSION::Result; +using ::android::hardware::audio::CPP_VERSION::TimeSpec; struct StreamOut : public IStreamOut { typedef MessageQueue CommandMQ; @@ -55,12 +61,12 @@ struct StreamOut : public IStreamOut { StreamOut(const sp& device, audio_stream_out_t* stream); - // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. + // Methods from ::android::hardware::audio::CPP_VERSION::IStream follow. Return getFrameSize() override; Return getFrameCount() override; Return getBufferSize() override; Return getSampleRate() override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override; Return getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override; #endif @@ -76,14 +82,14 @@ struct StreamOut : public IStreamOut { Return addEffect(uint64_t effectId) override; Return removeEffect(uint64_t effectId) override; Return standby() override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return getDevice() override; Return setDevice(const DeviceAddress& address) override; Return getParameters(const hidl_vec& keys, getParameters_cb _hidl_cb) override; Return setParameters(const hidl_vec& parameters) override; Return setConnectedState(const DeviceAddress& address, bool connected) override; -#elif defined(AUDIO_HAL_VERSION_4_0) +#elif MAJOR_VERSION == 4 Return getDevices(getDevices_cb _hidl_cb) override; Return setDevices(const hidl_vec& devices) override; Return getParameters(const hidl_vec& context, @@ -96,11 +102,11 @@ struct StreamOut : public IStreamOut { Return close() override; Return debug(const hidl_handle& fd, const hidl_vec& options) override; -#ifdef AUDIO_HAL_VERSION_2_0 +#if MAJOR_VERSION == 2 Return debugDump(const hidl_handle& fd) override; #endif - // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow. + // Methods from ::android::hardware::audio::CPP_VERSION::IStreamOut follow. Return getLatency() override; Return setVolume(float left, float right) override; Return prepareForWriting(uint32_t frameSize, uint32_t framesCount, @@ -120,7 +126,7 @@ struct StreamOut : public IStreamOut { Return stop() override; Return createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override; Return getMmapPosition(getMmapPosition_cb _hidl_cb) override; -#ifdef AUDIO_HAL_VERSION_4_0 +#if MAJOR_VERSION == 4 Return updateSourceMetadata(const SourceMetadata& sourceMetadata) override; Return selectPresentation(int32_t presentationId, int32_t programId) override; #endif @@ -148,7 +154,9 @@ struct StreamOut : public IStreamOut { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_STREAMOUT_H diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Util.h b/audio/core/all-versions/default/include/core/default/Util.h similarity index 85% rename from audio/core/all-versions/default/include/core/all-versions/default/Util.h rename to audio/core/all-versions/default/include/core/default/Util.h index 350fd867e6..2b8c3fd5b2 100644 --- a/audio/core/all-versions/default/include/core/all-versions/default/Util.h +++ b/audio/core/all-versions/default/include/core/default/Util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,10 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_UTIL_H +#define ANDROID_HARDWARE_AUDIO_UTIL_H + +#include PATH(android/hardware/audio/FILE_VERSION/types.h) #include #include @@ -24,10 +27,10 @@ namespace android { namespace hardware { namespace audio { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::CPP_VERSION::Result; /** @return true if gain is between 0 and 1 included. */ constexpr bool isGainNormalized(float gain) { @@ -68,7 +71,9 @@ static inline Result analyzeStatus(const char* className, const char* funcName, } // namespace util } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_UTIL_H diff --git a/audio/core/2.0/vts/OWNERS b/audio/core/all-versions/vts/OWNERS similarity index 79% rename from audio/core/2.0/vts/OWNERS rename to audio/core/all-versions/vts/OWNERS index 8711a9ff6a..0ea4666443 100644 --- a/audio/core/2.0/vts/OWNERS +++ b/audio/core/all-versions/vts/OWNERS @@ -2,4 +2,4 @@ elaurent@google.com krocard@google.com mnaganov@google.com yim@google.com -zhuoyao@google.com \ No newline at end of file +zhuoyao@google.com diff --git a/audio/core/2.0/vts/functional/2.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalTest.cpp similarity index 100% rename from audio/core/2.0/vts/functional/2.0/AudioPrimaryHidlHalTest.cpp rename to audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalTest.cpp diff --git a/audio/core/2.0/vts/functional/2.0/AudioPrimaryHidlHalUtils.h b/audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalUtils.h similarity index 81% rename from audio/core/2.0/vts/functional/2.0/AudioPrimaryHidlHalUtils.h rename to audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalUtils.h index 8578daa110..1cffd41831 100644 --- a/audio/core/2.0/vts/functional/2.0/AudioPrimaryHidlHalUtils.h +++ b/audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalUtils.h @@ -14,19 +14,19 @@ * limitations under the License. */ -#include -#include -#include +#include PATH(android/hardware/audio/FILE_VERSION/IStream.h) +#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) #include using ::android::hardware::hidl_handle; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; -using ::android::hardware::audio::common::V2_0::AudioChannelMask; -using ::android::hardware::audio::common::V2_0::AudioFormat; -using ::android::hardware::audio::V2_0::IStream; -using ::android::hardware::audio::V2_0::ParameterValue; -using ::android::hardware::audio::V2_0::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioFormat; +using ::android::hardware::audio::CPP_VERSION::IStream; +using ::android::hardware::audio::CPP_VERSION::ParameterValue; +using ::android::hardware::audio::CPP_VERSION::Result; using namespace ::android::hardware::audio::common::test::utility; diff --git a/audio/core/4.0/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp similarity index 100% rename from audio/core/4.0/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp rename to audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp diff --git a/audio/core/4.0/vts/functional/4.0/AudioPrimaryHidlHalUtils.h b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h similarity index 71% rename from audio/core/4.0/vts/functional/4.0/AudioPrimaryHidlHalUtils.h rename to audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h index 3b80e0b068..c30f3785c7 100644 --- a/audio/core/4.0/vts/functional/4.0/AudioPrimaryHidlHalUtils.h +++ b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h @@ -14,29 +14,29 @@ * limitations under the License. */ -#include -#include -#include +#include PATH(android/hardware/audio/FILE_VERSION/IStream.h) +#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) #include using ::android::hardware::hidl_bitfield; using ::android::hardware::hidl_handle; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; -using ::android::hardware::audio::common::V4_0::AudioChannelMask; -using ::android::hardware::audio::common::V4_0::AudioFormat; -using ::android::hardware::audio::V4_0::IStream; -using ::android::hardware::audio::V4_0::ParameterValue; -using ::android::hardware::audio::V4_0::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioFormat; +using ::android::hardware::audio::CPP_VERSION::IStream; +using ::android::hardware::audio::CPP_VERSION::ParameterValue; +using ::android::hardware::audio::CPP_VERSION::Result; using namespace ::android::hardware::audio::common::test::utility; -using Rotation = ::android::hardware::audio::V4_0::IPrimaryDevice::Rotation; -using ::android::hardware::audio::common::V4_0::AudioContentType; -using ::android::hardware::audio::common::V4_0::AudioUsage; -using ::android::hardware::audio::V4_0::MicrophoneInfo; -using ::android::hardware::audio::V4_0::SinkMetadata; -using ::android::hardware::audio::V4_0::SourceMetadata; +using Rotation = ::android::hardware::audio::CPP_VERSION::IPrimaryDevice::Rotation; +using ::android::hardware::audio::common::CPP_VERSION::AudioContentType; +using ::android::hardware::audio::common::CPP_VERSION::AudioUsage; +using ::android::hardware::audio::CPP_VERSION::MicrophoneInfo; +using ::android::hardware::audio::CPP_VERSION::SinkMetadata; +using ::android::hardware::audio::CPP_VERSION::SourceMetadata; struct Parameters { template diff --git a/audio/core/4.0/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp similarity index 58% rename from audio/core/4.0/vts/functional/Android.bp rename to audio/core/all-versions/vts/functional/Android.bp index 91a8c06581..41012f1ee9 100644 --- a/audio/core/4.0/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -14,6 +14,35 @@ // limitations under the License. // +cc_test { + name: "VtsHalAudioV2_0TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "2.0/AudioPrimaryHidlHalTest.cpp", + "ValidateAudioConfiguration.cpp" + ], + static_libs: [ + "android.hardware.audio.common.test.utility", + "android.hardware.audio@2.0", + "android.hardware.audio.common@2.0", + "libicuuc", + "libicuuc_stubdata", + "libxml2", + ], + shared_libs: [ + "libfmq", + ], + header_libs: [ + "android.hardware.audio.common.util@all-versions", + ], + test_suites: ["general-tests"], + cflags: [ + "-DMAJOR_VERSION=2", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] +} + cc_test { name: "VtsHalAudioV4_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -36,4 +65,9 @@ cc_test { "android.hardware.audio.common.util@all-versions", ], test_suites: ["general-tests"], + cflags: [ + "-DMAJOR_VERSION=4", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] } diff --git a/audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h similarity index 93% rename from audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.h rename to audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index 686f632894..79ccc3c210 100644 --- a/audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -#define LOG_TAG "VtsHalAudioV2_0TargetTest" +#define LOG_TAG "VtsHalAudioVTargetTest" #include #include @@ -35,11 +35,11 @@ #include -#include -#include -#include -#include -#include +#include PATH(android/hardware/audio/FILE_VERSION/IDevice.h) +#include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h) +#include PATH(android/hardware/audio/FILE_VERSION/IPrimaryDevice.h) +#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) #include #include @@ -48,12 +48,15 @@ #include "utility/AssertOk.h" #include "utility/Documentation.h" #include "utility/EnvironmentTearDown.h" -#define AUDIO_HAL_VERSION V2_0 #include "utility/PrettyPrintAudioTypes.h" #include "utility/ReturnIn.h" /** Provide version specific functions that are used in the generic tests */ +#if MAJOR_VERSION == 2 #include "2.0/AudioPrimaryHidlHalUtils.h" +#elif MAJOR_VERSION == 4 +#include "4.0/AudioPrimaryHidlHalUtils.h" +#endif using std::initializer_list; using std::list; @@ -73,38 +76,38 @@ using ::android::hardware::kSynchronizedReadWrite; using ::android::hardware::MessageQueue; using ::android::hardware::MQDescriptorSync; using ::android::hardware::Return; -using ::android::hardware::audio::V2_0::AudioDrain; -using ::android::hardware::audio::V2_0::DeviceAddress; -using ::android::hardware::audio::V2_0::IDevice; -using ::android::hardware::audio::V2_0::IPrimaryDevice; -using TtyMode = ::android::hardware::audio::V2_0::IPrimaryDevice::TtyMode; -using ::android::hardware::audio::V2_0::IDevicesFactory; -using ::android::hardware::audio::V2_0::IStream; -using ::android::hardware::audio::V2_0::IStreamIn; -using ::android::hardware::audio::V2_0::MessageQueueFlagBits; -using ::android::hardware::audio::V2_0::TimeSpec; -using ReadParameters = ::android::hardware::audio::V2_0::IStreamIn::ReadParameters; -using ReadStatus = ::android::hardware::audio::V2_0::IStreamIn::ReadStatus; +using ::android::hardware::audio::CPP_VERSION::AudioDrain; +using ::android::hardware::audio::CPP_VERSION::DeviceAddress; +using ::android::hardware::audio::CPP_VERSION::IDevice; +using ::android::hardware::audio::CPP_VERSION::IPrimaryDevice; +using TtyMode = ::android::hardware::audio::CPP_VERSION::IPrimaryDevice::TtyMode; +using ::android::hardware::audio::CPP_VERSION::IDevicesFactory; +using ::android::hardware::audio::CPP_VERSION::IStream; +using ::android::hardware::audio::CPP_VERSION::IStreamIn; +using ::android::hardware::audio::CPP_VERSION::MessageQueueFlagBits; +using ::android::hardware::audio::CPP_VERSION::TimeSpec; +using ReadParameters = ::android::hardware::audio::CPP_VERSION::IStreamIn::ReadParameters; +using ReadStatus = ::android::hardware::audio::CPP_VERSION::IStreamIn::ReadStatus; +using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioConfig; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioFormat; +using ::android::hardware::audio::common::CPP_VERSION::AudioHandleConsts; +using ::android::hardware::audio::common::CPP_VERSION::AudioHwSync; +using ::android::hardware::audio::common::CPP_VERSION::AudioInputFlag; +using ::android::hardware::audio::common::CPP_VERSION::AudioIoHandle; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioOffloadInfo; +using ::android::hardware::audio::common::CPP_VERSION::AudioOutputFlag; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::common::CPP_VERSION::ThreadInfo; using ::android::hardware::audio::common::utils::mkEnumBitfield; -using ::android::hardware::audio::common::V2_0::AudioChannelMask; -using ::android::hardware::audio::common::V2_0::AudioConfig; -using ::android::hardware::audio::common::V2_0::AudioDevice; -using ::android::hardware::audio::common::V2_0::AudioFormat; -using ::android::hardware::audio::common::V2_0::AudioHandleConsts; -using ::android::hardware::audio::common::V2_0::AudioHwSync; -using ::android::hardware::audio::common::V2_0::AudioInputFlag; -using ::android::hardware::audio::common::V2_0::AudioIoHandle; -using ::android::hardware::audio::common::V2_0::AudioMode; -using ::android::hardware::audio::common::V2_0::AudioOffloadInfo; -using ::android::hardware::audio::common::V2_0::AudioOutputFlag; -using ::android::hardware::audio::common::V2_0::AudioSource; -using ::android::hardware::audio::common::V2_0::ThreadInfo; -using ::android::hardware::audio::V2_0::IStreamOut; -using ::android::hardware::audio::V2_0::IStreamOutCallback; -using ::android::hardware::audio::V2_0::MmapBufferInfo; -using ::android::hardware::audio::V2_0::MmapPosition; -using ::android::hardware::audio::V2_0::ParameterValue; -using ::android::hardware::audio::V2_0::Result; +using ::android::hardware::audio::CPP_VERSION::IStreamOut; +using ::android::hardware::audio::CPP_VERSION::IStreamOutCallback; +using ::android::hardware::audio::CPP_VERSION::MmapBufferInfo; +using ::android::hardware::audio::CPP_VERSION::MmapPosition; +using ::android::hardware::audio::CPP_VERSION::ParameterValue; +using ::android::hardware::audio::CPP_VERSION::Result; using namespace ::android::hardware::audio::common::test::utility; @@ -163,7 +166,11 @@ TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) { doc::test("Test passing an invalid parameter to openDevice"); Result result; sp device; +#if MAJOR_VERSION == 2 auto invalidDevice = IDevicesFactory::Device(-1); +#elif MAJOR_VERSION == 4 + auto invalidDevice = "Non existing device"; +#endif ASSERT_OK(devicesFactory->openDevice(invalidDevice, returnIn(result, device))); ASSERT_EQ(Result::INVALID_ARGUMENTS, result); ASSERT_TRUE(device == nullptr); @@ -194,13 +201,19 @@ class AudioPrimaryHidlTest : public AudioHidlTest { private: void initPrimaryDevice() { Result result; +#if MAJOR_VERSION == 2 sp baseDevice; ASSERT_OK(devicesFactory->openDevice(IDevicesFactory::Device::PRIMARY, returnIn(result, baseDevice))); +#elif MAJOR_VERSION == 4 + ASSERT_OK(devicesFactory->openPrimaryDevice(returnIn(result, device))); +#endif ASSERT_OK(result); +#if MAJOR_VERSION == 2 ASSERT_TRUE(baseDevice != nullptr); device = IPrimaryDevice::castFrom(baseDevice); +#endif } }; sp AudioPrimaryHidlTest::device; @@ -609,10 +622,22 @@ class OutputStreamTest : public OpenStreamTest { auto flags = mkEnumBitfield(AudioOutputFlag::NONE); testOpen( [&](AudioIoHandle handle, AudioConfig config, auto cb) { +#if MAJOR_VERSION == 2 return device->openOutputStream(handle, address, config, flags, cb); +#elif MAJOR_VERSION == 4 + return device->openOutputStream(handle, address, config, flags, initMetadata, cb); +#endif }, config); } +#if MAJOR_VERSION == 4 + + protected: + const SourceMetadata initMetadata = { + { { AudioUsage::MEDIA, + AudioContentType::MUSIC, + 1 /* gain */ } }}; +#endif }; TEST_P(OutputStreamTest, OpenOutputStreamTest) { doc::test( @@ -651,7 +676,11 @@ class InputStreamTest : public OpenStreamTest { } protected: +#if MAJOR_VERSION == 2 const AudioSource initMetadata = AudioSource::DEFAULT; +#elif MAJOR_VERSION == 4 + const SinkMetadata initMetadata = {{{AudioSource::DEFAULT, 1 /* gain */}}}; +#endif }; TEST_P(InputStreamTest, OpenInputStreamTest) { diff --git a/audio/core/4.0/vts/functional/ValidateAudioConfiguration.cpp b/audio/core/all-versions/vts/functional/ValidateAudioConfiguration.cpp similarity index 84% rename from audio/core/4.0/vts/functional/ValidateAudioConfiguration.cpp rename to audio/core/all-versions/vts/functional/ValidateAudioConfiguration.cpp index 237ef47c4b..5b6f378265 100644 --- a/audio/core/4.0/vts/functional/ValidateAudioConfiguration.cpp +++ b/audio/core/all-versions/vts/functional/ValidateAudioConfiguration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. @@ -23,15 +23,12 @@ #define QUOTE(x) #x #define STRINGIFY(x) QUOTE(x) -#define AUDIO_HAL_VERSION V4_0 - TEST(CheckConfig, audioPolicyConfigurationValidation) { RecordProperty("description", "Verify that the audio policy configuration file " "is valid according to the schema"); std::vector locations = {"/odm/etc", "/vendor/etc", "/system/etc"}; - const char* xsd = - "/data/local/tmp/audio_policy_configuration_" STRINGIFY(AUDIO_HAL_VERSION) ".xsd"; + const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd"; EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("audio_policy_configuration.xml", locations, xsd); } diff --git a/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp b/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp deleted file mode 100644 index cadc2f1b43..0000000000 --- a/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "AEC_Effect_HAL" - -#include "AcousticEchoCancelerEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/AcousticEchoCancelerEffect.h b/audio/effect/2.0/default/AcousticEchoCancelerEffect.h deleted file mode 100644 index d36335c7b3..0000000000 --- a/audio/effect/2.0/default/AcousticEchoCancelerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H diff --git a/audio/effect/2.0/default/Android.bp b/audio/effect/2.0/default/Android.bp deleted file mode 100644 index db0098849c..0000000000 --- a/audio/effect/2.0/default/Android.bp +++ /dev/null @@ -1,50 +0,0 @@ -cc_library_shared { - name: "android.hardware.audio.effect@2.0-impl", - defaults: ["hidl_defaults"], - vendor: true, - relative_install_path: "hw", - srcs: [ - "AcousticEchoCancelerEffect.cpp", - "AudioBufferManager.cpp", - "AutomaticGainControlEffect.cpp", - "BassBoostEffect.cpp", - "Conversions.cpp", - "DownmixEffect.cpp", - "Effect.cpp", - "EffectsFactory.cpp", - "EnvironmentalReverbEffect.cpp", - "EqualizerEffect.cpp", - "LoudnessEnhancerEffect.cpp", - "NoiseSuppressionEffect.cpp", - "PresetReverbEffect.cpp", - "VirtualizerEffect.cpp", - "VisualizerEffect.cpp", - ], - - shared_libs: [ - "libbase", - "libcutils", - "libeffects", - "libfmq", - "libhidlbase", - "libhidlmemory", - "libhidltransport", - "liblog", - "libutils", - "android.hardware.audio.common-util", - "android.hardware.audio.common@2.0", - "android.hardware.audio.common@2.0-util", - "android.hardware.audio.effect@2.0", - "android.hidl.memory@1.0", - ], - - header_libs: [ - "android.hardware.audio.common.util@all-versions", - "android.hardware.audio.effect@all-versions-impl", - "libaudio_system_headers", - "libaudioclient_headers", - "libeffects_headers", - "libhardware_headers", - "libmedia_headers", - ], -} diff --git a/audio/effect/2.0/default/AudioBufferManager.cpp b/audio/effect/2.0/default/AudioBufferManager.cpp deleted file mode 100644 index 39918dd1c7..0000000000 --- a/audio/effect/2.0/default/AudioBufferManager.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "AudioBufferManager.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/AudioBufferManager.h b/audio/effect/2.0/default/AudioBufferManager.h deleted file mode 100644 index 789fbd1c8f..0000000000 --- a/audio/effect/2.0/default/AudioBufferManager.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUDIO_BUFFER_MANAGER_H_ -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUDIO_BUFFER_MANAGER_H_ - -#include - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUDIO_BUFFER_MANAGER_H_ diff --git a/audio/effect/2.0/default/AutomaticGainControlEffect.cpp b/audio/effect/2.0/default/AutomaticGainControlEffect.cpp deleted file mode 100644 index 7e00a8065f..0000000000 --- a/audio/effect/2.0/default/AutomaticGainControlEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "AGC_Effect_HAL" - -#include "AutomaticGainControlEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/AutomaticGainControlEffect.h b/audio/effect/2.0/default/AutomaticGainControlEffect.h deleted file mode 100644 index ef440d2e40..0000000000 --- a/audio/effect/2.0/default/AutomaticGainControlEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUTOMATICGAINCONTROLEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUTOMATICGAINCONTROLEFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUTOMATICGAINCONTROLEFFECT_H diff --git a/audio/effect/2.0/default/BassBoostEffect.cpp b/audio/effect/2.0/default/BassBoostEffect.cpp deleted file mode 100644 index df9e892d60..0000000000 --- a/audio/effect/2.0/default/BassBoostEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "BassBoost_HAL" - -#include "BassBoostEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/BassBoostEffect.h b/audio/effect/2.0/default/BassBoostEffect.h deleted file mode 100644 index 83179e28ef..0000000000 --- a/audio/effect/2.0/default/BassBoostEffect.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H - -#include - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H diff --git a/audio/effect/2.0/default/Conversions.cpp b/audio/effect/2.0/default/Conversions.cpp deleted file mode 100644 index b59752c982..0000000000 --- a/audio/effect/2.0/default/Conversions.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "Conversions.h" -#include "HidlUtils.h" - -using ::android::hardware::audio::common::V2_0::HidlUtils; - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/Conversions.h b/audio/effect/2.0/default/Conversions.h deleted file mode 100644 index 94c7f66ea6..0000000000 --- a/audio/effect/2.0/default/Conversions.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_CONVERSIONS_H_ -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_CONVERSIONS_H_ - -#include - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_CONVERSIONS_H_ diff --git a/audio/effect/2.0/default/DownmixEffect.cpp b/audio/effect/2.0/default/DownmixEffect.cpp deleted file mode 100644 index 1a51e13641..0000000000 --- a/audio/effect/2.0/default/DownmixEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "Downmix_HAL" - -#include "DownmixEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/DownmixEffect.h b/audio/effect/2.0/default/DownmixEffect.h deleted file mode 100644 index 6dbbb32836..0000000000 --- a/audio/effect/2.0/default/DownmixEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_DOWNMIXEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_DOWNMIXEFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_DOWNMIXEFFECT_H diff --git a/audio/effect/2.0/default/Effect.cpp b/audio/effect/2.0/default/Effect.cpp deleted file mode 100644 index e234e520b8..0000000000 --- a/audio/effect/2.0/default/Effect.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#define LOG_TAG "EffectHAL" -#define ATRACE_TAG ATRACE_TAG_AUDIO - -#include "Conversions.h" -#include "Effect.h" -#include "common/all-versions/default/EffectMap.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/Effect.h b/audio/effect/2.0/default/Effect.h deleted file mode 100644 index a4d194dab9..0000000000 --- a/audio/effect/2.0/default/Effect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H - -#include - -#include "AudioBufferManager.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H diff --git a/audio/effect/2.0/default/EffectsFactory.cpp b/audio/effect/2.0/default/EffectsFactory.cpp deleted file mode 100644 index a48a85f7c2..0000000000 --- a/audio/effect/2.0/default/EffectsFactory.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "EffectFactoryHAL" -#include "EffectsFactory.h" -#include "AcousticEchoCancelerEffect.h" -#include "AutomaticGainControlEffect.h" -#include "BassBoostEffect.h" -#include "Conversions.h" -#include "DownmixEffect.h" -#include "Effect.h" -#include "EnvironmentalReverbEffect.h" -#include "EqualizerEffect.h" -#include "HidlUtils.h" -#include "LoudnessEnhancerEffect.h" -#include "NoiseSuppressionEffect.h" -#include "PresetReverbEffect.h" -#include "VirtualizerEffect.h" -#include "VisualizerEffect.h" -#include "common/all-versions/default/EffectMap.h" - -using ::android::hardware::audio::common::V2_0::HidlUtils; - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/EffectsFactory.h b/audio/effect/2.0/default/EffectsFactory.h deleted file mode 100644 index f1bfbcff4c..0000000000 --- a/audio/effect/2.0/default/EffectsFactory.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H - -#include - -#include - -#include -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H diff --git a/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp b/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp deleted file mode 100644 index 017dd1f4cb..0000000000 --- a/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "EnvReverb_HAL" -#include - -#include "EnvironmentalReverbEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/EnvironmentalReverbEffect.h b/audio/effect/2.0/default/EnvironmentalReverbEffect.h deleted file mode 100644 index d93a53f42f..0000000000 --- a/audio/effect/2.0/default/EnvironmentalReverbEffect.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ENVIRONMENTALREVERBEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ENVIRONMENTALREVERBEFFECT_H - -#include - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ENVIRONMENTALREVERBEFFECT_H diff --git a/audio/effect/2.0/default/EqualizerEffect.cpp b/audio/effect/2.0/default/EqualizerEffect.cpp deleted file mode 100644 index d6e056c421..0000000000 --- a/audio/effect/2.0/default/EqualizerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "Equalizer_HAL" - -#include "EqualizerEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/EqualizerEffect.h b/audio/effect/2.0/default/EqualizerEffect.h deleted file mode 100644 index 54cdd50e13..0000000000 --- a/audio/effect/2.0/default/EqualizerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EQUALIZEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EQUALIZEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EQUALIZEREFFECT_H diff --git a/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp b/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp deleted file mode 100644 index 2dca0f4c39..0000000000 --- a/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "LoudnessEnhancer_HAL" - -#include "LoudnessEnhancerEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/LoudnessEnhancerEffect.h b/audio/effect/2.0/default/LoudnessEnhancerEffect.h deleted file mode 100644 index 992e238ef1..0000000000 --- a/audio/effect/2.0/default/LoudnessEnhancerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_LOUDNESSENHANCEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_LOUDNESSENHANCEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_LOUDNESSENHANCEREFFECT_H diff --git a/audio/effect/2.0/default/NoiseSuppressionEffect.cpp b/audio/effect/2.0/default/NoiseSuppressionEffect.cpp deleted file mode 100644 index 089e811e09..0000000000 --- a/audio/effect/2.0/default/NoiseSuppressionEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "NS_Effect_HAL" - -#include "NoiseSuppressionEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/NoiseSuppressionEffect.h b/audio/effect/2.0/default/NoiseSuppressionEffect.h deleted file mode 100644 index 0eee4b51b2..0000000000 --- a/audio/effect/2.0/default/NoiseSuppressionEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_NOISESUPPRESSIONEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_NOISESUPPRESSIONEFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_NOISESUPPRESSIONEFFECT_H diff --git a/audio/effect/2.0/default/OWNERS b/audio/effect/2.0/default/OWNERS deleted file mode 100644 index 6fdc97ca29..0000000000 --- a/audio/effect/2.0/default/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -elaurent@google.com -krocard@google.com -mnaganov@google.com diff --git a/audio/effect/2.0/default/PresetReverbEffect.cpp b/audio/effect/2.0/default/PresetReverbEffect.cpp deleted file mode 100644 index 0648f6a8eb..0000000000 --- a/audio/effect/2.0/default/PresetReverbEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "PresetReverb_HAL" - -#include "PresetReverbEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/PresetReverbEffect.h b/audio/effect/2.0/default/PresetReverbEffect.h deleted file mode 100644 index 1ea1626ffa..0000000000 --- a/audio/effect/2.0/default/PresetReverbEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_PRESETREVERBEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_PRESETREVERBEFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_PRESETREVERBEFFECT_H diff --git a/audio/effect/2.0/default/VirtualizerEffect.cpp b/audio/effect/2.0/default/VirtualizerEffect.cpp deleted file mode 100644 index 63d3eb925f..0000000000 --- a/audio/effect/2.0/default/VirtualizerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "Virtualizer_HAL" - -#include "VirtualizerEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/VirtualizerEffect.h b/audio/effect/2.0/default/VirtualizerEffect.h deleted file mode 100644 index 04f93c4c72..0000000000 --- a/audio/effect/2.0/default/VirtualizerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VIRTUALIZEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VIRTUALIZEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VIRTUALIZEREFFECT_H diff --git a/audio/effect/2.0/default/VisualizerEffect.cpp b/audio/effect/2.0/default/VisualizerEffect.cpp deleted file mode 100644 index 523552466d..0000000000 --- a/audio/effect/2.0/default/VisualizerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "Visualizer_HAL" - -#include "VisualizerEffect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/2.0/default/VisualizerEffect.h b/audio/effect/2.0/default/VisualizerEffect.h deleted file mode 100644 index 940f15de9b..0000000000 --- a/audio/effect/2.0/default/VisualizerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V2_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H diff --git a/audio/effect/2.0/vts/functional/Android.bp b/audio/effect/2.0/vts/functional/Android.bp deleted file mode 100644 index 38ca315fb6..0000000000 --- a/audio/effect/2.0/vts/functional/Android.bp +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright (C) 2016 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -cc_test { - name: "VtsHalAudioEffectV2_0TargetTest", - defaults: ["VtsHalTargetTestDefaults"], - srcs: [ - "VtsHalAudioEffectTargetTest.cpp", - "ValidateAudioEffectsConfiguration.cpp" - ], - static_libs: [ - "android.hardware.audio.common.test.utility", - "android.hardware.audio.common@2.0", - "android.hardware.audio.effect@2.0", - "android.hidl.allocator@1.0", - "android.hidl.memory@1.0", - "libeffectsconfig", - "libicuuc", - "libicuuc_stubdata", - "libxml2", - ], - header_libs: [ - "android.hardware.audio.common.util@all-versions", - ], - test_suites: ["general-tests"], -} diff --git a/audio/effect/2.0/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/2.0/vts/functional/VtsHalAudioEffectTargetTest.cpp deleted file mode 100644 index 078e420acb..0000000000 --- a/audio/effect/2.0/vts/functional/VtsHalAudioEffectTargetTest.cpp +++ /dev/null @@ -1,827 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "AudioEffectHidlHalTest" -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -using android::sp; -using android::hardware::hidl_handle; -using android::hardware::hidl_memory; -using android::hardware::hidl_string; -using android::hardware::hidl_vec; -using android::hardware::MQDescriptorSync; -using android::hardware::Return; -using android::hardware::Void; -using android::hardware::audio::common::utils::mkEnumBitfield; -using android::hardware::audio::common::V2_0::AudioDevice; -using android::hardware::audio::common::V2_0::AudioHandleConsts; -using android::hardware::audio::common::V2_0::AudioMode; -using android::hardware::audio::common::V2_0::AudioSource; -using android::hardware::audio::common::V2_0::Uuid; -using android::hardware::audio::effect::V2_0::AudioBuffer; -using android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig; -using android::hardware::audio::effect::V2_0::EffectBufferConfig; -using android::hardware::audio::effect::V2_0::EffectConfig; -using android::hardware::audio::effect::V2_0::EffectDescriptor; -using android::hardware::audio::effect::V2_0::EffectOffloadParameter; -using android::hardware::audio::effect::V2_0::IEffect; -using android::hardware::audio::effect::V2_0::IEffectsFactory; -using android::hardware::audio::effect::V2_0::IEqualizerEffect; -using android::hardware::audio::effect::V2_0::ILoudnessEnhancerEffect; -using android::hardware::audio::effect::V2_0::Result; -using android::hidl::allocator::V1_0::IAllocator; -using android::hidl::memory::V1_0::IMemory; - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) -#endif - -// Test environment for Audio Effects Factory HIDL HAL. -class AudioEffectsFactoryHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { - public: - // get the test environment singleton - static AudioEffectsFactoryHidlEnvironment* Instance() { - static AudioEffectsFactoryHidlEnvironment* instance = - new AudioEffectsFactoryHidlEnvironment; - return instance; - } - - virtual void registerTestServices() override { registerTestService(); } -}; - -// The main test class for Audio Effects Factory HIDL HAL. -class AudioEffectsFactoryHidlTest : public ::testing::VtsHalHidlTargetTestBase { - public: - void SetUp() override { - effectsFactory = ::testing::VtsHalHidlTargetTestBase::getService( - AudioEffectsFactoryHidlEnvironment::Instance()->getServiceName()); - ASSERT_NE(effectsFactory, nullptr); - } - - void TearDown() override { effectsFactory.clear(); } - - protected: - static void description(const std::string& description) { - RecordProperty("description", description); - } - - sp effectsFactory; -}; - -TEST_F(AudioEffectsFactoryHidlTest, EnumerateEffects) { - description("Verify that EnumerateEffects returns at least one effect"); - Result retval = Result::NOT_INITIALIZED; - size_t effectCount = 0; - Return ret = - effectsFactory->getAllDescriptors([&](Result r, const hidl_vec& result) { - retval = r; - effectCount = result.size(); - }); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_GT(effectCount, 0u); -} - -TEST_F(AudioEffectsFactoryHidlTest, CreateEffect) { - description("Verify that an effect can be created via CreateEffect"); - bool gotEffect = false; - Uuid effectUuid; - Return ret = - effectsFactory->getAllDescriptors([&](Result r, const hidl_vec& result) { - if (r == Result::OK && result.size() > 0) { - gotEffect = true; - effectUuid = result[0].uuid; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_TRUE(gotEffect); - Result retval = Result::NOT_INITIALIZED; - sp effect; - ret = effectsFactory->createEffect( - effectUuid, 1 /*session*/, 1 /*ioHandle*/, - [&](Result r, const sp& result, uint64_t /*effectId*/) { - retval = r; - if (r == Result::OK) { - effect = result; - } - }); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_NE(nullptr, effect.get()); -} - -TEST_F(AudioEffectsFactoryHidlTest, GetDescriptor) { - description( - "Verify that effects factory can provide an effect descriptor via " - "GetDescriptor"); - hidl_vec allDescriptors; - Return ret = - effectsFactory->getAllDescriptors([&](Result r, const hidl_vec& result) { - if (r == Result::OK) { - allDescriptors = result; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_GT(allDescriptors.size(), 0u); - for (size_t i = 0; i < allDescriptors.size(); ++i) { - ret = effectsFactory->getDescriptor(allDescriptors[i].uuid, - [&](Result r, const EffectDescriptor& result) { - EXPECT_EQ(r, Result::OK); - EXPECT_EQ(result, allDescriptors[i]); - }); - } - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectsFactoryHidlTest, DebugDumpInvalidArgument) { - description("Verify that debugDump doesn't crash on invalid arguments"); - Return ret = effectsFactory->debugDump(hidl_handle()); - ASSERT_TRUE(ret.isOk()); -} - -// Equalizer effect is required by CDD, but only the type is fixed. -// This is the same UUID as AudioEffect.EFFECT_TYPE_EQUALIZER in Java. -static const Uuid EQUALIZER_EFFECT_TYPE = { - 0x0bed4300, 0xddd6, 0x11db, 0x8f34, - std::array{{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}}; -// Loudness Enhancer effect is required by CDD, but only the type is fixed. -// This is the same UUID as AudioEffect.EFFECT_TYPE_LOUDNESS_ENHANCER in Java. -static const Uuid LOUDNESS_ENHANCER_EFFECT_TYPE = { - 0xfe3199be, 0xaed0, 0x413f, 0x87bb, - std::array{{0x11, 0x26, 0x0e, 0xb6, 0x3c, 0xf1}}}; - -// The main test class for Audio Effect HIDL HAL. -class AudioEffectHidlTest : public ::testing::VtsHalHidlTargetTestBase { - public: - void SetUp() override { - effectsFactory = ::testing::VtsHalHidlTargetTestBase::getService(); - ASSERT_NE(nullptr, effectsFactory.get()); - - findAndCreateEffect(getEffectType()); - ASSERT_NE(nullptr, effect.get()); - - Return ret = effect->init(); - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, ret); - } - - void TearDown() override { - effect.clear(); - effectsFactory.clear(); - } - - protected: - static void description(const std::string& description) { - RecordProperty("description", description); - } - - virtual Uuid getEffectType() { return EQUALIZER_EFFECT_TYPE; } - - void findAndCreateEffect(const Uuid& type); - void findEffectInstance(const Uuid& type, Uuid* uuid); - void getChannelCount(uint32_t* channelCount); - - sp effectsFactory; - sp effect; -}; - -void AudioEffectHidlTest::findAndCreateEffect(const Uuid& type) { - Uuid effectUuid; - findEffectInstance(type, &effectUuid); - Return ret = effectsFactory->createEffect( - effectUuid, 1 /*session*/, 1 /*ioHandle*/, - [&](Result r, const sp& result, uint64_t /*effectId*/) { - if (r == Result::OK) { - effect = result; - } - }); - ASSERT_TRUE(ret.isOk()); -} - -void AudioEffectHidlTest::findEffectInstance(const Uuid& type, Uuid* uuid) { - bool effectFound = false; - Return ret = - effectsFactory->getAllDescriptors([&](Result r, const hidl_vec& result) { - if (r == Result::OK) { - for (const auto& desc : result) { - if (desc.type == type) { - effectFound = true; - *uuid = desc.uuid; - break; - } - } - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_TRUE(effectFound); -} - -void AudioEffectHidlTest::getChannelCount(uint32_t* channelCount) { - Result retval; - EffectConfig currentConfig; - Return ret = effect->getConfig([&](Result r, const EffectConfig& conf) { - retval = r; - if (r == Result::OK) { - currentConfig = conf; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); - ASSERT_TRUE(audio_channel_mask_is_valid( - static_cast(currentConfig.outputCfg.channels))); - *channelCount = audio_channel_count_from_out_mask( - static_cast(currentConfig.outputCfg.channels)); -} - -TEST_F(AudioEffectHidlTest, Close) { - description("Verify that an effect can be closed"); - Return ret = effect->close(); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); -} - -TEST_F(AudioEffectHidlTest, GetDescriptor) { - description("Verify that an effect can return its own descriptor via GetDescriptor"); - Result retval = Result::NOT_INITIALIZED; - Uuid actualType; - Return ret = effect->getDescriptor([&](Result r, const EffectDescriptor& desc) { - retval = r; - if (r == Result::OK) { - actualType = desc.type; - } - }); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(getEffectType(), actualType); -} - -TEST_F(AudioEffectHidlTest, GetSetConfig) { - description( - "Verify that it is possible to manipulate effect config via Get / " - "SetConfig"); - Result retval = Result::NOT_INITIALIZED; - EffectConfig currentConfig; - Return ret = effect->getConfig([&](Result r, const EffectConfig& conf) { - retval = r; - if (r == Result::OK) { - currentConfig = conf; - } - }); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); - Return ret2 = effect->setConfig(currentConfig, nullptr, nullptr); - EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, ret2); -} - -TEST_F(AudioEffectHidlTest, GetConfigReverse) { - description("Verify that GetConfigReverse does not crash"); - Return ret = effect->getConfigReverse([&](Result, const EffectConfig&) {}); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, GetSupportedAuxChannelsConfigs) { - description("Verify that GetSupportedAuxChannelsConfigs does not crash"); - Return ret = effect->getSupportedAuxChannelsConfigs( - 0, [&](Result, const hidl_vec&) {}); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, GetAuxChannelsConfig) { - description("Verify that GetAuxChannelsConfig does not crash"); - Return ret = effect->getAuxChannelsConfig([&](Result, const EffectAuxChannelsConfig&) {}); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, SetAuxChannelsConfig) { - description("Verify that SetAuxChannelsConfig does not crash"); - Return ret = effect->setAuxChannelsConfig(EffectAuxChannelsConfig()); - EXPECT_TRUE(ret.isOk()); -} - -// Not generated automatically because AudioBuffer contains -// instances of hidl_memory which can't be compared properly -// in general case due to presence of handles. -// -// However, in this particular case, handles must not present -// thus comparison is possible. -// -// operator== must be defined in the same namespace as the structures. -namespace android { -namespace hardware { -namespace audio { -namespace effect { -namespace V2_0 { -inline bool operator==(const AudioBuffer& lhs, const AudioBuffer& rhs) { - return lhs.id == rhs.id && lhs.frameCount == rhs.frameCount && lhs.data.handle() == nullptr && - rhs.data.handle() == nullptr; -} - -inline bool operator==(const EffectBufferConfig& lhs, const EffectBufferConfig& rhs) { - return lhs.buffer == rhs.buffer && lhs.samplingRateHz == rhs.samplingRateHz && - lhs.channels == rhs.channels && lhs.format == rhs.format && - lhs.accessMode == rhs.accessMode && lhs.mask == rhs.mask; -} - -inline bool operator==(const EffectConfig& lhs, const EffectConfig& rhs) { - return lhs.inputCfg == rhs.inputCfg && lhs.outputCfg == rhs.outputCfg; -} -} // namespace V2_0 -} // namespace effect -} // namespace audio -} // namespace hardware -} // namespace android - -TEST_F(AudioEffectHidlTest, Reset) { - description("Verify that Reset preserves effect configuration"); - Result retval = Result::NOT_INITIALIZED; - EffectConfig originalConfig; - Return ret = effect->getConfig([&](Result r, const EffectConfig& conf) { - retval = r; - if (r == Result::OK) { - originalConfig = conf; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); - Return ret2 = effect->reset(); - EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, ret2); - EffectConfig configAfterReset; - ret = effect->getConfig([&](Result r, const EffectConfig& conf) { - retval = r; - if (r == Result::OK) { - configAfterReset = conf; - } - }); - EXPECT_EQ(originalConfig, configAfterReset); -} - -TEST_F(AudioEffectHidlTest, DisableEnableDisable) { - description("Verify Disable -> Enable -> Disable sequence for an effect"); - Return ret = effect->disable(); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::INVALID_ARGUMENTS, ret); - ret = effect->enable(); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); - ret = effect->disable(); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); -} - -TEST_F(AudioEffectHidlTest, SetDevice) { - description("Verify that SetDevice works for an output chain effect"); - Return ret = effect->setDevice(mkEnumBitfield(AudioDevice::OUT_SPEAKER)); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); -} - -TEST_F(AudioEffectHidlTest, SetAndGetVolume) { - description("Verify that SetAndGetVolume method works for an effect"); - uint32_t channelCount; - getChannelCount(&channelCount); - hidl_vec volumes; - volumes.resize(channelCount); - for (uint32_t i = 0; i < channelCount; ++i) { - volumes[i] = 0; - } - Result retval = Result::NOT_INITIALIZED; - Return ret = - effect->setAndGetVolume(volumes, [&](Result r, const hidl_vec&) { retval = r; }); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); -} - -TEST_F(AudioEffectHidlTest, VolumeChangeNotification) { - description("Verify that effect accepts VolumeChangeNotification"); - uint32_t channelCount; - getChannelCount(&channelCount); - hidl_vec volumes; - volumes.resize(channelCount); - for (uint32_t i = 0; i < channelCount; ++i) { - volumes[i] = 0; - } - Return ret = effect->volumeChangeNotification(volumes); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); -} - -TEST_F(AudioEffectHidlTest, SetAudioMode) { - description("Verify that SetAudioMode works for an effect"); - Return ret = effect->setAudioMode(AudioMode::NORMAL); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); -} - -TEST_F(AudioEffectHidlTest, SetConfigReverse) { - description("Verify that SetConfigReverse does not crash"); - Return ret = effect->setConfigReverse(EffectConfig(), nullptr, nullptr); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, SetInputDevice) { - description("Verify that SetInputDevice does not crash"); - Return ret = effect->setInputDevice(mkEnumBitfield(AudioDevice::IN_BUILTIN_MIC)); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, SetAudioSource) { - description("Verify that SetAudioSource does not crash"); - Return ret = effect->setAudioSource(AudioSource::MIC); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, Offload) { - description("Verify that calling Offload method does not crash"); - EffectOffloadParameter offloadParam; - offloadParam.isOffload = false; - offloadParam.ioHandle = static_cast(AudioHandleConsts::AUDIO_IO_HANDLE_NONE); - Return ret = effect->offload(offloadParam); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, PrepareForProcessing) { - description("Verify that PrepareForProcessing method works for an effect"); - Result retval = Result::NOT_INITIALIZED; - Return ret = effect->prepareForProcessing( - [&](Result r, const MQDescriptorSync&) { retval = r; }); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); -} - -TEST_F(AudioEffectHidlTest, SetProcessBuffers) { - description("Verify that SetProcessBuffers works for an effect"); - sp ashmem = IAllocator::getService("ashmem"); - ASSERT_NE(nullptr, ashmem.get()); - bool success = false; - AudioBuffer buffer; - Return ret = ashmem->allocate(1024, [&](bool s, const hidl_memory& memory) { - success = s; - if (s) { - buffer.data = memory; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_TRUE(success); - Return ret2 = effect->setProcessBuffers(buffer, buffer); - EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, ret2); -} - -TEST_F(AudioEffectHidlTest, Command) { - description("Verify that Command does not crash"); - Return ret = - effect->command(0, hidl_vec(), 0, [&](int32_t, const hidl_vec&) {}); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, SetParameter) { - description("Verify that SetParameter does not crash"); - Return ret = effect->setParameter(hidl_vec(), hidl_vec()); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, GetParameter) { - description("Verify that GetParameter does not crash"); - Return ret = - effect->getParameter(hidl_vec(), 0, [&](Result, const hidl_vec&) {}); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, GetSupportedConfigsForFeature) { - description("Verify that GetSupportedConfigsForFeature does not crash"); - Return ret = effect->getSupportedConfigsForFeature( - 0, 0, 0, [&](Result, uint32_t, const hidl_vec&) {}); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, GetCurrentConfigForFeature) { - description("Verify that GetCurrentConfigForFeature does not crash"); - Return ret = - effect->getCurrentConfigForFeature(0, 0, [&](Result, const hidl_vec&) {}); - EXPECT_TRUE(ret.isOk()); -} - -TEST_F(AudioEffectHidlTest, SetCurrentConfigForFeature) { - description("Verify that SetCurrentConfigForFeature does not crash"); - Return ret = effect->setCurrentConfigForFeature(0, hidl_vec()); - EXPECT_TRUE(ret.isOk()); -} - -// The main test class for Equalizer Audio Effect HIDL HAL. -class EqualizerAudioEffectHidlTest : public AudioEffectHidlTest { - public: - void SetUp() override { - AudioEffectHidlTest::SetUp(); - equalizer = IEqualizerEffect::castFrom(effect); - ASSERT_NE(nullptr, equalizer.get()); - } - - protected: - Uuid getEffectType() override { return EQUALIZER_EFFECT_TYPE; } - void getNumBands(uint16_t* numBands); - void getLevelRange(int16_t* minLevel, int16_t* maxLevel); - void getBandFrequencyRange(uint16_t band, uint32_t* minFreq, uint32_t* centerFreq, - uint32_t* maxFreq); - void getPresetCount(size_t* count); - - sp equalizer; -}; - -void EqualizerAudioEffectHidlTest::getNumBands(uint16_t* numBands) { - Result retval = Result::NOT_INITIALIZED; - Return ret = equalizer->getNumBands([&](Result r, uint16_t b) { - retval = r; - if (retval == Result::OK) { - *numBands = b; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); -} - -void EqualizerAudioEffectHidlTest::getLevelRange(int16_t* minLevel, int16_t* maxLevel) { - Result retval = Result::NOT_INITIALIZED; - Return ret = equalizer->getLevelRange([&](Result r, int16_t min, int16_t max) { - retval = r; - if (retval == Result::OK) { - *minLevel = min; - *maxLevel = max; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); -} - -void EqualizerAudioEffectHidlTest::getBandFrequencyRange(uint16_t band, uint32_t* minFreq, - uint32_t* centerFreq, uint32_t* maxFreq) { - Result retval = Result::NOT_INITIALIZED; - Return ret = - equalizer->getBandFrequencyRange(band, [&](Result r, uint32_t min, uint32_t max) { - retval = r; - if (retval == Result::OK) { - *minFreq = min; - *maxFreq = max; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); - ret = equalizer->getBandCenterFrequency(band, [&](Result r, uint32_t center) { - retval = r; - if (retval == Result::OK) { - *centerFreq = center; - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); -} - -void EqualizerAudioEffectHidlTest::getPresetCount(size_t* count) { - Result retval = Result::NOT_INITIALIZED; - Return ret = equalizer->getPresetNames([&](Result r, const hidl_vec& names) { - retval = r; - if (retval == Result::OK) { - *count = names.size(); - } - }); - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(Result::OK, retval); -} - -TEST_F(EqualizerAudioEffectHidlTest, GetNumBands) { - description("Verify that Equalizer effect reports at least one band"); - uint16_t numBands = 0; - getNumBands(&numBands); - EXPECT_GT(numBands, 0); -} - -TEST_F(EqualizerAudioEffectHidlTest, GetLevelRange) { - description("Verify that Equalizer effect reports adequate band level range"); - int16_t minLevel = 0x7fff, maxLevel = 0; - getLevelRange(&minLevel, &maxLevel); - EXPECT_GT(maxLevel, minLevel); -} - -TEST_F(EqualizerAudioEffectHidlTest, GetSetBandLevel) { - description("Verify that manipulating band levels works for Equalizer effect"); - uint16_t numBands = 0; - getNumBands(&numBands); - ASSERT_GT(numBands, 0); - int16_t levels[3]{0x7fff, 0, 0}; - getLevelRange(&levels[0], &levels[2]); - ASSERT_GT(levels[2], levels[0]); - levels[1] = (levels[2] + levels[0]) / 2; - for (uint16_t i = 0; i < numBands; ++i) { - for (size_t j = 0; j < ARRAY_SIZE(levels); ++j) { - Return ret = equalizer->setBandLevel(i, levels[j]); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); - Result retval = Result::NOT_INITIALIZED; - int16_t actualLevel; - Return ret2 = equalizer->getBandLevel(i, [&](Result r, int16_t l) { - retval = r; - if (retval == Result::OK) { - actualLevel = l; - } - }); - EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(levels[j], actualLevel); - } - } -} - -TEST_F(EqualizerAudioEffectHidlTest, GetBandCenterFrequencyAndRange) { - description("Verify that Equalizer effect reports adequate band frequency range"); - uint16_t numBands = 0; - getNumBands(&numBands); - ASSERT_GT(numBands, 0); - for (uint16_t i = 0; i < numBands; ++i) { - uint32_t minFreq = 0xffffffff, centerFreq = 0xffffffff, maxFreq = 0xffffffff; - getBandFrequencyRange(i, &minFreq, ¢erFreq, &maxFreq); - // Note: NXP legacy implementation reports "1" as upper bound for last band, - // so this check fails. - EXPECT_GE(maxFreq, centerFreq); - EXPECT_GE(centerFreq, minFreq); - } -} - -TEST_F(EqualizerAudioEffectHidlTest, GetBandForFrequency) { - description("Verify that Equalizer effect supports GetBandForFrequency correctly"); - uint16_t numBands = 0; - getNumBands(&numBands); - ASSERT_GT(numBands, 0); - for (uint16_t i = 0; i < numBands; ++i) { - uint32_t freqs[3]{0, 0, 0}; - getBandFrequencyRange(i, &freqs[0], &freqs[1], &freqs[2]); - // NXP legacy implementation reports "1" as upper bound for last band, some - // of the checks fail. - for (size_t j = 0; j < ARRAY_SIZE(freqs); ++j) { - if (j == 0) { - freqs[j]++; - } // Min frequency is an open interval. - Result retval = Result::NOT_INITIALIZED; - uint16_t actualBand = numBands + 1; - Return ret = equalizer->getBandForFrequency(freqs[j], [&](Result r, uint16_t b) { - retval = r; - if (retval == Result::OK) { - actualBand = b; - } - }); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(i, actualBand) << "Frequency: " << freqs[j]; - } - } -} - -TEST_F(EqualizerAudioEffectHidlTest, GetPresetNames) { - description("Verify that Equalizer effect reports at least one preset"); - size_t presetCount; - getPresetCount(&presetCount); - EXPECT_GT(presetCount, 0u); -} - -TEST_F(EqualizerAudioEffectHidlTest, GetSetCurrentPreset) { - description("Verify that manipulating the current preset for Equalizer effect"); - size_t presetCount; - getPresetCount(&presetCount); - ASSERT_GT(presetCount, 0u); - for (uint16_t i = 0; i < presetCount; ++i) { - Return ret = equalizer->setCurrentPreset(i); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); - Result retval = Result::NOT_INITIALIZED; - uint16_t actualPreset = 0xffff; - Return ret2 = equalizer->getCurrentPreset([&](Result r, uint16_t p) { - retval = r; - if (retval == Result::OK) { - actualPreset = p; - } - }); - EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(i, actualPreset); - } -} - -TEST_F(EqualizerAudioEffectHidlTest, GetSetAllProperties) { - description( - "Verify that setting band levels and presets works via Get / " - "SetAllProperties for Equalizer effect"); - using AllProperties = android::hardware::audio::effect::V2_0::IEqualizerEffect::AllProperties; - uint16_t numBands = 0; - getNumBands(&numBands); - ASSERT_GT(numBands, 0); - AllProperties props; - props.bandLevels.resize(numBands); - for (size_t i = 0; i < numBands; ++i) { - props.bandLevels[i] = 0; - } - - AllProperties actualProps; - Result retval = Result::NOT_INITIALIZED; - - // Verify setting of the band levels via properties. - props.curPreset = -1; - Return ret = equalizer->setAllProperties(props); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); - Return ret2 = equalizer->getAllProperties([&](Result r, AllProperties p) { - retval = r; - if (retval == Result::OK) { - actualProps = p; - } - }); - EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(props.bandLevels, actualProps.bandLevels); - - // Verify setting of the current preset via properties. - props.curPreset = 0; // Assuming there is at least one preset. - ret = equalizer->setAllProperties(props); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); - ret2 = equalizer->getAllProperties([&](Result r, AllProperties p) { - retval = r; - if (retval == Result::OK) { - actualProps = p; - } - }); - EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(props.curPreset, actualProps.curPreset); -} - -// The main test class for Equalizer Audio Effect HIDL HAL. -class LoudnessEnhancerAudioEffectHidlTest : public AudioEffectHidlTest { - public: - void SetUp() override { - AudioEffectHidlTest::SetUp(); - enhancer = ILoudnessEnhancerEffect::castFrom(effect); - ASSERT_NE(nullptr, enhancer.get()); - } - - protected: - Uuid getEffectType() override { return LOUDNESS_ENHANCER_EFFECT_TYPE; } - - sp enhancer; -}; - -TEST_F(LoudnessEnhancerAudioEffectHidlTest, GetSetTargetGain) { - description( - "Verify that manipulating the target gain works for Loudness Enhancer " - "effect"); - const int32_t gain = 100; - Return ret = enhancer->setTargetGain(gain); - EXPECT_TRUE(ret.isOk()); - EXPECT_EQ(Result::OK, ret); - int32_t actualGain = 0; - Result retval; - Return ret2 = enhancer->getTargetGain([&](Result r, int32_t g) { - retval = r; - if (retval == Result::OK) { - actualGain = g; - } - }); - EXPECT_TRUE(ret2.isOk()); - EXPECT_EQ(Result::OK, retval); - EXPECT_EQ(gain, actualGain); -} - -int main(int argc, char** argv) { - ::testing::AddGlobalTestEnvironment(AudioEffectsFactoryHidlEnvironment::Instance()); - ::testing::InitGoogleTest(&argc, argv); - AudioEffectsFactoryHidlEnvironment::Instance()->init(&argc, argv); - int status = RUN_ALL_TESTS(); - LOG(INFO) << "Test result = " << status; - return status; -} diff --git a/audio/effect/4.0/default/AcousticEchoCancelerEffect.cpp b/audio/effect/4.0/default/AcousticEchoCancelerEffect.cpp deleted file mode 100644 index 242740e582..0000000000 --- a/audio/effect/4.0/default/AcousticEchoCancelerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "AEC_Effect_HAL" - -#include "AcousticEchoCancelerEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/AcousticEchoCancelerEffect.h b/audio/effect/4.0/default/AcousticEchoCancelerEffect.h deleted file mode 100644 index 0ac0a1e0df..0000000000 --- a/audio/effect/4.0/default/AcousticEchoCancelerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ACOUSTICECHOCANCELEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ACOUSTICECHOCANCELEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ACOUSTICECHOCANCELEREFFECT_H diff --git a/audio/effect/4.0/default/Android.bp b/audio/effect/4.0/default/Android.bp deleted file mode 100644 index dcb2269a9b..0000000000 --- a/audio/effect/4.0/default/Android.bp +++ /dev/null @@ -1,50 +0,0 @@ -cc_library_shared { - name: "android.hardware.audio.effect@4.0-impl", - defaults: ["hidl_defaults"], - vendor: true, - relative_install_path: "hw", - srcs: [ - "AcousticEchoCancelerEffect.cpp", - "AudioBufferManager.cpp", - "AutomaticGainControlEffect.cpp", - "BassBoostEffect.cpp", - "Conversions.cpp", - "DownmixEffect.cpp", - "Effect.cpp", - "EffectsFactory.cpp", - "EnvironmentalReverbEffect.cpp", - "EqualizerEffect.cpp", - "LoudnessEnhancerEffect.cpp", - "NoiseSuppressionEffect.cpp", - "PresetReverbEffect.cpp", - "VirtualizerEffect.cpp", - "VisualizerEffect.cpp", - ], - - shared_libs: [ - "libbase", - "libcutils", - "libeffects", - "libfmq", - "libhidlbase", - "libhidlmemory", - "libhidltransport", - "liblog", - "libutils", - "android.hardware.audio.common-util", - "android.hardware.audio.common@4.0", - "android.hardware.audio.common@4.0-util", - "android.hardware.audio.effect@4.0", - "android.hidl.memory@1.0", - ], - - header_libs: [ - "android.hardware.audio.common.util@all-versions", - "android.hardware.audio.effect@all-versions-impl", - "libaudio_system_headers", - "libaudioclient_headers", - "libeffects_headers", - "libhardware_headers", - "libmedia_headers", - ], -} diff --git a/audio/effect/4.0/default/AudioBufferManager.cpp b/audio/effect/4.0/default/AudioBufferManager.cpp deleted file mode 100644 index 2d75f3fdbb..0000000000 --- a/audio/effect/4.0/default/AudioBufferManager.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2018 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 "AudioBufferManager.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/AudioBufferManager.h b/audio/effect/4.0/default/AudioBufferManager.h deleted file mode 100644 index 1f151e6b99..0000000000 --- a/audio/effect/4.0/default/AudioBufferManager.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUDIO_BUFFER_MANAGER_H_ -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUDIO_BUFFER_MANAGER_H_ - -#include - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUDIO_BUFFER_MANAGER_H_ diff --git a/audio/effect/4.0/default/AutomaticGainControlEffect.cpp b/audio/effect/4.0/default/AutomaticGainControlEffect.cpp deleted file mode 100644 index 9d21c8ae6b..0000000000 --- a/audio/effect/4.0/default/AutomaticGainControlEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "AGC_Effect_HAL" - -#include "AutomaticGainControlEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/AutomaticGainControlEffect.h b/audio/effect/4.0/default/AutomaticGainControlEffect.h deleted file mode 100644 index 7f12007f8f..0000000000 --- a/audio/effect/4.0/default/AutomaticGainControlEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUTOMATICGAINCONTROLEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUTOMATICGAINCONTROLEFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUTOMATICGAINCONTROLEFFECT_H diff --git a/audio/effect/4.0/default/BassBoostEffect.cpp b/audio/effect/4.0/default/BassBoostEffect.cpp deleted file mode 100644 index 74a626b79e..0000000000 --- a/audio/effect/4.0/default/BassBoostEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "BassBoost_HAL" - -#include "BassBoostEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/BassBoostEffect.h b/audio/effect/4.0/default/BassBoostEffect.h deleted file mode 100644 index 206a75fab4..0000000000 --- a/audio/effect/4.0/default/BassBoostEffect.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_BASSBOOSTEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_BASSBOOSTEFFECT_H - -#include - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_BASSBOOSTEFFECT_H diff --git a/audio/effect/4.0/default/Conversions.cpp b/audio/effect/4.0/default/Conversions.cpp deleted file mode 100644 index 91285ae6b8..0000000000 --- a/audio/effect/4.0/default/Conversions.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2018 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 "Conversions.h" -#include "HidlUtils.h" - -using ::android::hardware::audio::common::V4_0::HidlUtils; - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/Conversions.h b/audio/effect/4.0/default/Conversions.h deleted file mode 100644 index 50e380fe2e..0000000000 --- a/audio/effect/4.0/default/Conversions.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_CONVERSIONS_H_ -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_CONVERSIONS_H_ - -#include - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_CONVERSIONS_H_ diff --git a/audio/effect/4.0/default/DownmixEffect.cpp b/audio/effect/4.0/default/DownmixEffect.cpp deleted file mode 100644 index 07fcab2f1c..0000000000 --- a/audio/effect/4.0/default/DownmixEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "Downmix_HAL" - -#include "DownmixEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/DownmixEffect.h b/audio/effect/4.0/default/DownmixEffect.h deleted file mode 100644 index 5ae820b76f..0000000000 --- a/audio/effect/4.0/default/DownmixEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_DOWNMIXEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_DOWNMIXEFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_DOWNMIXEFFECT_H diff --git a/audio/effect/4.0/default/Effect.cpp b/audio/effect/4.0/default/Effect.cpp deleted file mode 100644 index 707044bff0..0000000000 --- a/audio/effect/4.0/default/Effect.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 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 - -#define LOG_TAG "EffectHAL" -#define ATRACE_TAG ATRACE_TAG_AUDIO - -#include "Conversions.h" -#include "Effect.h" -#include "common/all-versions/default/EffectMap.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/Effect.h b/audio/effect/4.0/default/Effect.h deleted file mode 100644 index 9ca79c4596..0000000000 --- a/audio/effect/4.0/default/Effect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECT_H - -#include - -#include "AudioBufferManager.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECT_H diff --git a/audio/effect/4.0/default/EffectsFactory.cpp b/audio/effect/4.0/default/EffectsFactory.cpp deleted file mode 100644 index ee0413df8f..0000000000 --- a/audio/effect/4.0/default/EffectsFactory.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2018 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 "EffectFactoryHAL" -#include "EffectsFactory.h" -#include "AcousticEchoCancelerEffect.h" -#include "AutomaticGainControlEffect.h" -#include "BassBoostEffect.h" -#include "Conversions.h" -#include "DownmixEffect.h" -#include "Effect.h" -#include "EnvironmentalReverbEffect.h" -#include "EqualizerEffect.h" -#include "HidlUtils.h" -#include "LoudnessEnhancerEffect.h" -#include "NoiseSuppressionEffect.h" -#include "PresetReverbEffect.h" -#include "VirtualizerEffect.h" -#include "VisualizerEffect.h" -#include "common/all-versions/default/EffectMap.h" - -using ::android::hardware::audio::common::V4_0::HidlUtils; - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/EffectsFactory.h b/audio/effect/4.0/default/EffectsFactory.h deleted file mode 100644 index 48e4b4cb9f..0000000000 --- a/audio/effect/4.0/default/EffectsFactory.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECTSFACTORY_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECTSFACTORY_H - -#include - -#include - -#include -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECTSFACTORY_H diff --git a/audio/effect/4.0/default/EnvironmentalReverbEffect.cpp b/audio/effect/4.0/default/EnvironmentalReverbEffect.cpp deleted file mode 100644 index cc3102d1f8..0000000000 --- a/audio/effect/4.0/default/EnvironmentalReverbEffect.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2018 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 "EnvReverb_HAL" -#include - -#include "EnvironmentalReverbEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/EnvironmentalReverbEffect.h b/audio/effect/4.0/default/EnvironmentalReverbEffect.h deleted file mode 100644 index c0fb25c02c..0000000000 --- a/audio/effect/4.0/default/EnvironmentalReverbEffect.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ENVIRONMENTALREVERBEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ENVIRONMENTALREVERBEFFECT_H - -#include - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ENVIRONMENTALREVERBEFFECT_H diff --git a/audio/effect/4.0/default/EqualizerEffect.cpp b/audio/effect/4.0/default/EqualizerEffect.cpp deleted file mode 100644 index d0a40bc3cd..0000000000 --- a/audio/effect/4.0/default/EqualizerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "Equalizer_HAL" - -#include "EqualizerEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/EqualizerEffect.h b/audio/effect/4.0/default/EqualizerEffect.h deleted file mode 100644 index 7c9463b01e..0000000000 --- a/audio/effect/4.0/default/EqualizerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EQUALIZEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EQUALIZEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EQUALIZEREFFECT_H diff --git a/audio/effect/4.0/default/LoudnessEnhancerEffect.cpp b/audio/effect/4.0/default/LoudnessEnhancerEffect.cpp deleted file mode 100644 index e3c5184225..0000000000 --- a/audio/effect/4.0/default/LoudnessEnhancerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "LoudnessEnhancer_HAL" - -#include "LoudnessEnhancerEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/LoudnessEnhancerEffect.h b/audio/effect/4.0/default/LoudnessEnhancerEffect.h deleted file mode 100644 index 64fa26add8..0000000000 --- a/audio/effect/4.0/default/LoudnessEnhancerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_LOUDNESSENHANCEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_LOUDNESSENHANCEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_LOUDNESSENHANCEREFFECT_H diff --git a/audio/effect/4.0/default/NoiseSuppressionEffect.cpp b/audio/effect/4.0/default/NoiseSuppressionEffect.cpp deleted file mode 100644 index e83a8e3373..0000000000 --- a/audio/effect/4.0/default/NoiseSuppressionEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "NS_Effect_HAL" - -#include "NoiseSuppressionEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/NoiseSuppressionEffect.h b/audio/effect/4.0/default/NoiseSuppressionEffect.h deleted file mode 100644 index 36d45afaf7..0000000000 --- a/audio/effect/4.0/default/NoiseSuppressionEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_NOISESUPPRESSIONEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_NOISESUPPRESSIONEFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_NOISESUPPRESSIONEFFECT_H diff --git a/audio/effect/4.0/default/OWNERS b/audio/effect/4.0/default/OWNERS deleted file mode 100644 index 6fdc97ca29..0000000000 --- a/audio/effect/4.0/default/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -elaurent@google.com -krocard@google.com -mnaganov@google.com diff --git a/audio/effect/4.0/default/PresetReverbEffect.cpp b/audio/effect/4.0/default/PresetReverbEffect.cpp deleted file mode 100644 index 0c23be73af..0000000000 --- a/audio/effect/4.0/default/PresetReverbEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "PresetReverb_HAL" - -#include "PresetReverbEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/PresetReverbEffect.h b/audio/effect/4.0/default/PresetReverbEffect.h deleted file mode 100644 index 3eeae0a04b..0000000000 --- a/audio/effect/4.0/default/PresetReverbEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_PRESETREVERBEFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_PRESETREVERBEFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_PRESETREVERBEFFECT_H diff --git a/audio/effect/4.0/default/VirtualizerEffect.cpp b/audio/effect/4.0/default/VirtualizerEffect.cpp deleted file mode 100644 index f50e8adb7b..0000000000 --- a/audio/effect/4.0/default/VirtualizerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "Virtualizer_HAL" - -#include "VirtualizerEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/VirtualizerEffect.h b/audio/effect/4.0/default/VirtualizerEffect.h deleted file mode 100644 index 8e7114e569..0000000000 --- a/audio/effect/4.0/default/VirtualizerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VIRTUALIZEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VIRTUALIZEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VIRTUALIZEREFFECT_H diff --git a/audio/effect/4.0/default/VisualizerEffect.cpp b/audio/effect/4.0/default/VisualizerEffect.cpp deleted file mode 100644 index 8d4f100ced..0000000000 --- a/audio/effect/4.0/default/VisualizerEffect.cpp +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2018 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 "Visualizer_HAL" - -#include "VisualizerEffect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION diff --git a/audio/effect/4.0/default/VisualizerEffect.h b/audio/effect/4.0/default/VisualizerEffect.h deleted file mode 100644 index 6b5ab9c393..0000000000 --- a/audio/effect/4.0/default/VisualizerEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VISUALIZEREFFECT_H -#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VISUALIZEREFFECT_H - -#include - -#include "Effect.h" - -#define AUDIO_HAL_VERSION V4_0 -#include -#undef AUDIO_HAL_VERSION - -#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VISUALIZEREFFECT_H diff --git a/audio/effect/4.0/vts/OWNERS b/audio/effect/4.0/vts/OWNERS deleted file mode 100644 index 8711a9ff6a..0000000000 --- a/audio/effect/4.0/vts/OWNERS +++ /dev/null @@ -1,5 +0,0 @@ -elaurent@google.com -krocard@google.com -mnaganov@google.com -yim@google.com -zhuoyao@google.com \ No newline at end of file diff --git a/audio/effect/4.0/vts/functional/ValidateAudioEffectsConfiguration.cpp b/audio/effect/4.0/vts/functional/ValidateAudioEffectsConfiguration.cpp deleted file mode 100644 index 2e94143871..0000000000 --- a/audio/effect/4.0/vts/functional/ValidateAudioEffectsConfiguration.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include - -#include "utility/ValidateXml.h" - -// Stringify the argument. -#define QUOTE(x) #x -#define STRINGIFY(x) QUOTE(x) - -#define AUDIO_HAL_VERSION V4_0 - -TEST(CheckConfig, audioEffectsConfigurationValidation) { - RecordProperty("description", - "Verify that the effects configuration file is valid according to the schema"); - using namespace android::effectsConfig; - - std::vector locations(std::begin(DEFAULT_LOCATIONS), std::end(DEFAULT_LOCATIONS)); - const char* xsd = "/data/local/tmp/audio_effects_conf_" STRINGIFY(AUDIO_HAL_VERSION) ".xsd"; - // Starting with V4, audio effect XML is required - EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, xsd); -} diff --git a/audio/effect/all-versions/OWNERS b/audio/effect/all-versions/OWNERS deleted file mode 100644 index 6fdc97ca29..0000000000 --- a/audio/effect/all-versions/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -elaurent@google.com -krocard@google.com -mnaganov@google.com diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.impl.h b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.cpp similarity index 94% rename from audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.impl.h rename to audio/effect/all-versions/default/AcousticEchoCancelerEffect.cpp index 8ad80a22a0..0b60622c05 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.impl.h +++ b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "AEC_Effect_HAL" + +#include "AcousticEchoCancelerEffect.h" #include #include @@ -25,7 +27,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { AcousticEchoCancelerEffect::AcousticEchoCancelerEffect(effect_handle_t handle) @@ -33,7 +35,7 @@ AcousticEchoCancelerEffect::AcousticEchoCancelerEffect(effect_handle_t handle) AcousticEchoCancelerEffect::~AcousticEchoCancelerEffect() {} -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return AcousticEchoCancelerEffect::init() { return mEffect->init(); } @@ -163,7 +165,7 @@ Return AcousticEchoCancelerEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAcousticEchoCancelerEffect +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IAcousticEchoCancelerEffect // follow. Return AcousticEchoCancelerEffect::setEchoDelay(uint32_t echoDelayMs) { return mEffect->setParam(AEC_PARAM_ECHO_DELAY, echoDelayMs); @@ -174,7 +176,7 @@ Return AcousticEchoCancelerEffect::getEchoDelay(getEchoDelay_cb _hidl_cb) } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.h b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.h similarity index 85% rename from audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.h rename to audio/effect/all-versions/default/AcousticEchoCancelerEffect.h index 37744b370a..c18f88b276 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.h +++ b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_ACOUSTICECHOCANCELEREFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_ACOUSTICECHOCANCELEREFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IAcousticEchoCancelerEffect.h) + +#include "Effect.h" #include @@ -26,7 +31,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -34,13 +39,13 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAcousticEchoCancelerEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::effect::CPP_VERSION::IAcousticEchoCancelerEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct AcousticEchoCancelerEffect : public IAcousticEchoCancelerEffect { explicit AcousticEchoCancelerEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -85,7 +90,7 @@ struct AcousticEchoCancelerEffect : public IAcousticEchoCancelerEffect { Return close() override; // Methods from - // ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAcousticEchoCancelerEffect follow. + // ::android::hardware::audio::effect::CPP_VERSION::IAcousticEchoCancelerEffect follow. Return setEchoDelay(uint32_t echoDelayMs) override; Return getEchoDelay(getEchoDelay_cb _hidl_cb) override; @@ -96,8 +101,10 @@ struct AcousticEchoCancelerEffect : public IAcousticEchoCancelerEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_ACOUSTICECHOCANCELEREFFECT_H diff --git a/audio/effect/all-versions/default/Android.bp b/audio/effect/all-versions/default/Android.bp index ed2a093050..ce41481974 100644 --- a/audio/effect/all-versions/default/Android.bp +++ b/audio/effect/all-versions/default/Android.bp @@ -1,10 +1,25 @@ -cc_library_headers { - name: "android.hardware.audio.effect@all-versions-impl", +cc_library_shared { + name: "android.hardware.audio.effect@2.0-impl", defaults: ["hidl_defaults"], vendor: true, relative_install_path: "hw", - - export_include_dirs: ["include"], + srcs: [ + "AcousticEchoCancelerEffect.cpp", + "AudioBufferManager.cpp", + "AutomaticGainControlEffect.cpp", + "BassBoostEffect.cpp", + "Conversions.cpp", + "DownmixEffect.cpp", + "Effect.cpp", + "EffectsFactory.cpp", + "EnvironmentalReverbEffect.cpp", + "EqualizerEffect.cpp", + "LoudnessEnhancerEffect.cpp", + "NoiseSuppressionEffect.cpp", + "PresetReverbEffect.cpp", + "VirtualizerEffect.cpp", + "VisualizerEffect.cpp", + ], shared_libs: [ "libbase", @@ -17,15 +32,78 @@ cc_library_headers { "liblog", "libutils", "android.hardware.audio.common-util", + "android.hardware.audio.common@2.0", + "android.hardware.audio.common@2.0-util", + "android.hardware.audio.effect@2.0", "android.hidl.memory@1.0", ], header_libs: [ + "android.hardware.audio.common.util@all-versions", "libaudio_system_headers", "libaudioclient_headers", "libeffects_headers", "libhardware_headers", "libmedia_headers", - "android.hardware.audio.common.util@all-versions", ], + cflags: [ + "-DMAJOR_VERSION=2", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] +} + +cc_library_shared { + name: "android.hardware.audio.effect@4.0-impl", + defaults: ["hidl_defaults"], + vendor: true, + relative_install_path: "hw", + srcs: [ + "AcousticEchoCancelerEffect.cpp", + "AudioBufferManager.cpp", + "AutomaticGainControlEffect.cpp", + "BassBoostEffect.cpp", + "Conversions.cpp", + "DownmixEffect.cpp", + "Effect.cpp", + "EffectsFactory.cpp", + "EnvironmentalReverbEffect.cpp", + "EqualizerEffect.cpp", + "LoudnessEnhancerEffect.cpp", + "NoiseSuppressionEffect.cpp", + "PresetReverbEffect.cpp", + "VirtualizerEffect.cpp", + "VisualizerEffect.cpp", + ], + + shared_libs: [ + "libbase", + "libcutils", + "libeffects", + "libfmq", + "libhidlbase", + "libhidlmemory", + "libhidltransport", + "liblog", + "libutils", + "android.hardware.audio.common-util", + "android.hardware.audio.common@4.0", + "android.hardware.audio.common@4.0-util", + "android.hardware.audio.effect@4.0", + "android.hidl.memory@1.0", + ], + + header_libs: [ + "android.hardware.audio.common.util@all-versions", + "libaudio_system_headers", + "libaudioclient_headers", + "libeffects_headers", + "libhardware_headers", + "libmedia_headers", + ], + cflags: [ + "-DMAJOR_VERSION=4", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] } diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.impl.h b/audio/effect/all-versions/default/AudioBufferManager.cpp similarity index 94% rename from audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.impl.h rename to audio/effect/all-versions/default/AudioBufferManager.cpp index 71ccd2d520..9a638fda2c 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.impl.h +++ b/audio/effect/all-versions/default/AudioBufferManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,7 @@ * limitations under the License. */ -#include +#include "AudioBufferManager.h" #include @@ -53,7 +53,7 @@ void AudioBufferManager::removeEntry(uint64_t id) { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { AudioBufferWrapper::AudioBufferWrapper(const AudioBuffer& buffer) @@ -83,7 +83,7 @@ bool AudioBufferWrapper::init() { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.h b/audio/effect/all-versions/default/AudioBufferManager.h similarity index 75% rename from audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.h rename to audio/effect/all-versions/default/AudioBufferManager.h index 34dea2d03b..8b956cdb9b 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.h +++ b/audio/effect/all-versions/default/AudioBufferManager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,10 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_AUDIO_BUFFER_MANAGER_H_ +#define ANDROID_HARDWARE_AUDIO_EFFECT_AUDIO_BUFFER_MANAGER_H_ + +#include PATH(android/hardware/audio/effect/FILE_VERSION/types.h) #include @@ -24,14 +27,14 @@ #include #include -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer; +using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; using ::android::hidl::memory::V1_0::IMemory; namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { class AudioBufferWrapper : public RefBase { @@ -51,13 +54,13 @@ class AudioBufferWrapper : public RefBase { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::implementation::AudioBufferWrapper; +using ::android::hardware::audio::effect::CPP_VERSION::implementation::AudioBufferWrapper; namespace android { @@ -67,7 +70,7 @@ class AudioBufferManager : public Singleton { bool wrap(const AudioBuffer& buffer, sp* wrapper); private: - friend class hardware::audio::effect::AUDIO_HAL_VERSION::implementation::AudioBufferWrapper; + friend class hardware::audio::effect::CPP_VERSION::implementation::AudioBufferWrapper; // Called by AudioBufferWrapper. void removeEntry(uint64_t id); @@ -77,3 +80,5 @@ class AudioBufferManager : public Singleton { }; } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_AUDIO_BUFFER_MANAGER_H_ diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.impl.h b/audio/effect/all-versions/default/AutomaticGainControlEffect.cpp similarity index 95% rename from audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.impl.h rename to audio/effect/all-versions/default/AutomaticGainControlEffect.cpp index e2e751e86b..651dd1b228 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.impl.h +++ b/audio/effect/all-versions/default/AutomaticGainControlEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "AGC_Effect_HAL" + +#include "AutomaticGainControlEffect.h" #include @@ -24,7 +26,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { AutomaticGainControlEffect::AutomaticGainControlEffect(effect_handle_t handle) @@ -46,7 +48,7 @@ void AutomaticGainControlEffect::propertiesToHal( halProperties->limiterEnabled = properties.limiterEnabled; } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return AutomaticGainControlEffect::init() { return mEffect->init(); } @@ -176,7 +178,7 @@ Return AutomaticGainControlEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAutomaticGainControlEffect +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IAutomaticGainControlEffect // follow. Return AutomaticGainControlEffect::setTargetLevel(int16_t targetLevelMb) { return mEffect->setParam(AGC_PARAM_TARGET_LEVEL, targetLevelMb); @@ -219,7 +221,7 @@ Return AutomaticGainControlEffect::getAllProperties(getAllProperties_cb _h } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.h b/audio/effect/all-versions/default/AutomaticGainControlEffect.h similarity index 87% rename from audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.h rename to audio/effect/all-versions/default/AutomaticGainControlEffect.h index fce6cd6cc0..a281b1ddcd 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.h +++ b/audio/effect/all-versions/default/AutomaticGainControlEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_AUTOMATICGAINCONTROLEFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_AUTOMATICGAINCONTROLEFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IAutomaticGainControlEffect.h) + +#include "Effect.h" #include @@ -28,7 +33,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -36,13 +41,13 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAutomaticGainControlEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::effect::CPP_VERSION::IAutomaticGainControlEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct AutomaticGainControlEffect : public IAutomaticGainControlEffect { explicit AutomaticGainControlEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -87,7 +92,7 @@ struct AutomaticGainControlEffect : public IAutomaticGainControlEffect { Return close() override; // Methods from - // ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAutomaticGainControlEffect follow. + // ::android::hardware::audio::effect::CPP_VERSION::IAutomaticGainControlEffect follow. Return setTargetLevel(int16_t targetLevelMb) override; Return getTargetLevel(getTargetLevel_cb _hidl_cb) override; Return setCompGain(int16_t compGainMb) override; @@ -110,8 +115,10 @@ struct AutomaticGainControlEffect : public IAutomaticGainControlEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_AUTOMATICGAINCONTROLEFFECT_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.impl.h b/audio/effect/all-versions/default/BassBoostEffect.cpp similarity index 94% rename from audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.impl.h rename to audio/effect/all-versions/default/BassBoostEffect.cpp index 7bcb4a3497..6f7763db8e 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.impl.h +++ b/audio/effect/all-versions/default/BassBoostEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "BassBoost_HAL" + +#include "BassBoostEffect.h" #include #include @@ -25,14 +27,14 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { BassBoostEffect::BassBoostEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {} BassBoostEffect::~BassBoostEffect() {} -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return BassBoostEffect::init() { return mEffect->init(); } @@ -159,7 +161,7 @@ Return BassBoostEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IBassBoostEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect follow. Return BassBoostEffect::isStrengthSupported(isStrengthSupported_cb _hidl_cb) { return mEffect->getIntegerParam(BASSBOOST_PARAM_STRENGTH_SUPPORTED, _hidl_cb); } @@ -173,7 +175,7 @@ Return BassBoostEffect::getStrength(getStrength_cb _hidl_cb) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.h b/audio/effect/all-versions/default/BassBoostEffect.h similarity index 85% rename from audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.h rename to audio/effect/all-versions/default/BassBoostEffect.h index b79e7a4b62..a184ac2cc8 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.h +++ b/audio/effect/all-versions/default/BassBoostEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,14 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IBassBoostEffect.h) + +#include + +#include "Effect.h" #include @@ -26,7 +33,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -34,13 +41,13 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IBassBoostEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct BassBoostEffect : public IBassBoostEffect { explicit BassBoostEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -84,7 +91,7 @@ struct BassBoostEffect : public IBassBoostEffect { const hidl_vec& configData) override; Return close() override; - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IBassBoostEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect follow. Return isStrengthSupported(isStrengthSupported_cb _hidl_cb) override; Return setStrength(uint16_t strength) override; Return getStrength(getStrength_cb _hidl_cb) override; @@ -96,8 +103,10 @@ struct BassBoostEffect : public IBassBoostEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h b/audio/effect/all-versions/default/Conversions.cpp similarity index 87% rename from audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h rename to audio/effect/all-versions/default/Conversions.cpp index 0884d8f5d4..50b0562502 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h +++ b/audio/effect/all-versions/default/Conversions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,21 +14,24 @@ * limitations under the License. */ -#include +#include "Conversions.h" +#include "HidlUtils.h" + +using ::android::hardware::audio::common::CPP_VERSION::HidlUtils; #include #include #include -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils; +using ::android::hardware::audio::common::CPP_VERSION::HidlUtils; using ::android::hardware::audio::common::utils::EnumBitfield; namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { void effectDescriptorFromHal(const effect_descriptor_t& halDescriptor, @@ -52,7 +55,7 @@ std::string uuidToString(const effect_uuid_t& halUuid) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.h b/audio/effect/all-versions/default/Conversions.h similarity index 71% rename from audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.h rename to audio/effect/all-versions/default/Conversions.h index 3f9317f763..75aab24efe 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.h +++ b/audio/effect/all-versions/default/Conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,10 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_CONVERSIONS_H_ +#define ANDROID_HARDWARE_AUDIO_EFFECT_CONVERSIONS_H_ + +#include PATH(android/hardware/audio/effect/FILE_VERSION/types.h) #include @@ -24,18 +27,20 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; void effectDescriptorFromHal(const effect_descriptor_t& halDescriptor, EffectDescriptor* descriptor); std::string uuidToString(const effect_uuid_t& halUuid); } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_CONVERSIONS_H_ diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.impl.h b/audio/effect/all-versions/default/DownmixEffect.cpp similarity index 94% rename from audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.impl.h rename to audio/effect/all-versions/default/DownmixEffect.cpp index abef10ea09..94da70e0df 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.impl.h +++ b/audio/effect/all-versions/default/DownmixEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "Downmix_HAL" + +#include "DownmixEffect.h" #include #include @@ -25,14 +27,14 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { DownmixEffect::DownmixEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {} DownmixEffect::~DownmixEffect() {} -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return DownmixEffect::init() { return mEffect->init(); } @@ -159,7 +161,7 @@ Return DownmixEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IDownmixEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IDownmixEffect follow. Return DownmixEffect::setType(IDownmixEffect::Type preset) { return mEffect->setParam(DOWNMIX_PARAM_TYPE, static_cast(preset)); } @@ -172,7 +174,7 @@ Return DownmixEffect::getType(getType_cb _hidl_cb) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.h b/audio/effect/all-versions/default/DownmixEffect.h similarity index 86% rename from audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.h rename to audio/effect/all-versions/default/DownmixEffect.h index dbbb64c160..6d34c28dd2 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.h +++ b/audio/effect/all-versions/default/DownmixEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_DOWNMIXEFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_DOWNMIXEFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IDownmixEffect.h) + +#include "Effect.h" #include @@ -26,7 +31,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -34,13 +39,13 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IDownmixEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::effect::CPP_VERSION::IDownmixEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct DownmixEffect : public IDownmixEffect { explicit DownmixEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -84,7 +89,7 @@ struct DownmixEffect : public IDownmixEffect { const hidl_vec& configData) override; Return close() override; - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IDownmixEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IDownmixEffect follow. Return setType(IDownmixEffect::Type preset) override; Return getType(getType_cb _hidl_cb) override; @@ -95,8 +100,10 @@ struct DownmixEffect : public IDownmixEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_DOWNMIXEFFECT_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.impl.h b/audio/effect/all-versions/default/Effect.cpp similarity index 97% rename from audio/effect/all-versions/default/include/effect/all-versions/default/Effect.impl.h rename to audio/effect/all-versions/default/Effect.cpp index 61c9805663..3e5148fabb 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.impl.h +++ b/audio/effect/all-versions/default/Effect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,14 @@ * limitations under the License. */ -#include +#include + +#define LOG_TAG "EffectHAL" +#define ATRACE_TAG ATRACE_TAG_AUDIO + +#include "Conversions.h" +#include "Effect.h" +#include "common/all-versions/default/EffectMap.h" #include @@ -30,13 +37,13 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::MessageQueueFlagBits; +using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioFormat; +using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield; +using ::android::hardware::audio::effect::CPP_VERSION::MessageQueueFlagBits; namespace { @@ -479,7 +486,7 @@ Result Effect::setParameterImpl(uint32_t paramSize, const void* paramData, uint3 &halParamBuffer[0]); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return Effect::init() { return sendCommandReturningStatus(EFFECT_CMD_INIT, "INIT"); } @@ -707,7 +714,7 @@ Return Effect::close() { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h similarity index 88% rename from audio/effect/all-versions/default/include/effect/all-versions/default/Effect.h rename to audio/effect/all-versions/default/Effect.h index 0b62cccb22..f6a12d95e5 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.h +++ b/audio/effect/all-versions/default/Effect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_EFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_EFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffect.h) + +#include "AudioBufferManager.h" #include #include @@ -34,7 +39,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -42,20 +47,20 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioDeviceBitfield; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectFeature; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::common::CPP_VERSION::Uuid; +using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioDeviceBitfield; +using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; +using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::EffectFeature; +using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; +using ::android::hardware::audio::effect::CPP_VERSION::IEffect; +using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct Effect : public IEffect { typedef MessageQueue StatusMQ; @@ -64,7 +69,7 @@ struct Effect : public IEffect { explicit Effect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -234,8 +239,10 @@ struct Effect : public IEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_EFFECT_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.impl.h b/audio/effect/all-versions/default/EffectsFactory.cpp similarity index 89% rename from audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.impl.h rename to audio/effect/all-versions/default/EffectsFactory.cpp index f3256f1539..d2d8a466b3 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.impl.h +++ b/audio/effect/all-versions/default/EffectsFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,25 @@ * limitations under the License. */ -#include +#define LOG_TAG "EffectFactoryHAL" +#include "EffectsFactory.h" +#include "AcousticEchoCancelerEffect.h" +#include "AutomaticGainControlEffect.h" +#include "BassBoostEffect.h" +#include "Conversions.h" +#include "DownmixEffect.h" +#include "Effect.h" +#include "EnvironmentalReverbEffect.h" +#include "EqualizerEffect.h" +#include "HidlUtils.h" +#include "LoudnessEnhancerEffect.h" +#include "NoiseSuppressionEffect.h" +#include "PresetReverbEffect.h" +#include "VirtualizerEffect.h" +#include "VisualizerEffect.h" +#include "common/all-versions/default/EffectMap.h" + +using ::android::hardware::audio::common::CPP_VERSION::HidlUtils; #include #include @@ -30,13 +48,13 @@ #include #include -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils; +using ::android::hardware::audio::common::CPP_VERSION::HidlUtils; namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { // static @@ -69,7 +87,7 @@ sp EffectsFactory::dispatchEffectInstanceCreation(const effect_descript return new Effect(handle); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectsFactory follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory follow. Return EffectsFactory::getAllDescriptors(getAllDescriptors_cb _hidl_cb) { Result retval(Result::OK); hidl_vec result; @@ -189,7 +207,7 @@ IEffectsFactory* HIDL_FETCH_IEffectsFactory(const char* name) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.h b/audio/effect/all-versions/default/EffectsFactory.h similarity index 66% rename from audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.h rename to audio/effect/all-versions/default/EffectsFactory.h index dd374340ce..0cbfaa20b7 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.h +++ b/audio/effect/all-versions/default/EffectsFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,14 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H + +#include + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffectsFactory.h) + +#include #include #include @@ -26,7 +33,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -34,20 +41,20 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectsFactory; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::common::CPP_VERSION::Uuid; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::IEffect; +using ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct EffectsFactory : public IEffectsFactory { - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectsFactory follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory follow. Return getAllDescriptors(getAllDescriptors_cb _hidl_cb) override; Return getDescriptor(const Uuid& uid, getDescriptor_cb _hidl_cb) override; Return createEffect(const Uuid& uid, int32_t session, int32_t ioHandle, createEffect_cb _hidl_cb) override; Return debugDump( - const hidl_handle& fd); //< in V2_0::IEffectsFactory only, alias of debug + const hidl_handle& fd); //< in CPP_VERSION::IEffectsFactory only, alias of debug Return debug(const hidl_handle& fd, const hidl_vec& options) override; private: @@ -58,8 +65,10 @@ struct EffectsFactory : public IEffectsFactory { extern "C" IEffectsFactory* HIDL_FETCH_IEffectsFactory(const char* name); } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.impl.h b/audio/effect/all-versions/default/EnvironmentalReverbEffect.cpp similarity index 96% rename from audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.impl.h rename to audio/effect/all-versions/default/EnvironmentalReverbEffect.cpp index 39a4092e8c..1ade7b810b 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.impl.h +++ b/audio/effect/all-versions/default/EnvironmentalReverbEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,10 @@ * limitations under the License. */ -#include +#define LOG_TAG "EnvReverb_HAL" +#include + +#include "EnvironmentalReverbEffect.h" #include @@ -24,7 +27,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { EnvironmentalReverbEffect::EnvironmentalReverbEffect(effect_handle_t handle) @@ -60,7 +63,7 @@ void EnvironmentalReverbEffect::propertiesToHal( halProperties->density = properties.density; } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return EnvironmentalReverbEffect::init() { return mEffect->init(); } @@ -190,7 +193,7 @@ Return EnvironmentalReverbEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEnvironmentalReverbEffect +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEnvironmentalReverbEffect // follow. Return EnvironmentalReverbEffect::setBypass(bool bypass) { return mEffect->setParam(REVERB_PARAM_BYPASS, bypass); @@ -297,7 +300,7 @@ Return EnvironmentalReverbEffect::getAllProperties(getAllProperties_cb _hi } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.h b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h similarity index 80% rename from audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.h rename to audio/effect/all-versions/default/EnvironmentalReverbEffect.h index 2215cf8569..7e6597bae6 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.h +++ b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,14 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_ENVIRONMENTALREVERBEFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_ENVIRONMENTALREVERBEFFECT_H + +#include + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IEnvironmentalReverbEffect.h) + +#include "Effect.h" #include @@ -28,7 +35,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -36,23 +43,23 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEnvironmentalReverbEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; +using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; +using ::android::hardware::audio::effect::CPP_VERSION::IEffect; +using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; +using ::android::hardware::audio::effect::CPP_VERSION::IEnvironmentalReverbEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect { explicit EnvironmentalReverbEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -97,7 +104,7 @@ struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect { Return close() override; // Methods from - // ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEnvironmentalReverbEffect follow. + // ::android::hardware::audio::effect::CPP_VERSION::IEnvironmentalReverbEffect follow. Return setBypass(bool bypass) override; Return getBypass(getBypass_cb _hidl_cb) override; Return setRoomLevel(int16_t roomLevel) override; @@ -136,8 +143,10 @@ struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_ENVIRONMENTALREVERBEFFECT_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.impl.h b/audio/effect/all-versions/default/EqualizerEffect.cpp similarity index 96% rename from audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.impl.h rename to audio/effect/all-versions/default/EqualizerEffect.cpp index db6bed8d2e..f6177b79b4 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.impl.h +++ b/audio/effect/all-versions/default/EqualizerEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "Equalizer_HAL" + +#include "EqualizerEffect.h" #include @@ -26,7 +28,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { EqualizerEffect::EqualizerEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {} @@ -55,7 +57,7 @@ std::vector EqualizerEffect::propertiesToHal( return halBuffer; } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return EqualizerEffect::init() { return mEffect->init(); } @@ -182,7 +184,7 @@ Return EqualizerEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEqualizerEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect follow. Return EqualizerEffect::getNumBands(getNumBands_cb _hidl_cb) { return mEffect->getIntegerParam(EQ_PARAM_NUM_BANDS, _hidl_cb); } @@ -285,7 +287,7 @@ Return EqualizerEffect::getAllProperties(getAllProperties_cb _hidl_cb) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.h b/audio/effect/all-versions/default/EqualizerEffect.h similarity index 79% rename from audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.h rename to audio/effect/all-versions/default/EqualizerEffect.h index e150465038..5e1e2b984b 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.h +++ b/audio/effect/all-versions/default/EqualizerEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_EQUALIZEREFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_EQUALIZEREFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IEqualizerEffect.h) + +#include "Effect.h" #include @@ -30,7 +35,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -38,23 +43,23 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEqualizerEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; +using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; +using ::android::hardware::audio::effect::CPP_VERSION::IEffect; +using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; +using ::android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct EqualizerEffect : public IEqualizerEffect { explicit EqualizerEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -98,7 +103,7 @@ struct EqualizerEffect : public IEqualizerEffect { const hidl_vec& configData) override; Return close() override; - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEqualizerEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect follow. Return getNumBands(getNumBands_cb _hidl_cb) override; Return getLevelRange(getLevelRange_cb _hidl_cb) override; Return setBandLevel(uint16_t band, int16_t level) override; @@ -124,8 +129,10 @@ struct EqualizerEffect : public IEqualizerEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_EQUALIZEREFFECT_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.impl.h b/audio/effect/all-versions/default/LoudnessEnhancerEffect.cpp similarity index 94% rename from audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.impl.h rename to audio/effect/all-versions/default/LoudnessEnhancerEffect.cpp index 88210e954b..6918bdf533 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.impl.h +++ b/audio/effect/all-versions/default/LoudnessEnhancerEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "LoudnessEnhancer_HAL" + +#include "LoudnessEnhancerEffect.h" #include @@ -27,7 +29,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { LoudnessEnhancerEffect::LoudnessEnhancerEffect(effect_handle_t handle) @@ -35,7 +37,7 @@ LoudnessEnhancerEffect::LoudnessEnhancerEffect(effect_handle_t handle) LoudnessEnhancerEffect::~LoudnessEnhancerEffect() {} -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return LoudnessEnhancerEffect::init() { return mEffect->init(); } @@ -162,7 +164,7 @@ Return LoudnessEnhancerEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::ILoudnessEnhancerEffect +// Methods from ::android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect // follow. Return LoudnessEnhancerEffect::setTargetGain(int32_t targetGainMb) { return mEffect->setParam(LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB, targetGainMb); @@ -182,7 +184,7 @@ Return LoudnessEnhancerEffect::getTargetGain(getTargetGain_cb _hidl_cb) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.h b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h similarity index 75% rename from audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.h rename to audio/effect/all-versions/default/LoudnessEnhancerEffect.h index 182e79160d..6eb8a8c293 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.h +++ b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_LOUDNESSENHANCEREFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_LOUDNESSENHANCEREFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/ILoudnessEnhancerEffect.h) + +#include "Effect.h" #include @@ -26,7 +31,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -34,23 +39,23 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::ILoudnessEnhancerEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; +using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; +using ::android::hardware::audio::effect::CPP_VERSION::IEffect; +using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; +using ::android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect { explicit LoudnessEnhancerEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -94,7 +99,7 @@ struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect { const hidl_vec& configData) override; Return close() override; - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::ILoudnessEnhancerEffect + // Methods from ::android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect // follow. Return setTargetGain(int32_t targetGainMb) override; Return getTargetGain(getTargetGain_cb _hidl_cb) override; @@ -106,8 +111,10 @@ struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_LOUDNESSENHANCEREFFECT_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.impl.h b/audio/effect/all-versions/default/NoiseSuppressionEffect.cpp similarity index 95% rename from audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.impl.h rename to audio/effect/all-versions/default/NoiseSuppressionEffect.cpp index f32399c51c..4756719661 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.impl.h +++ b/audio/effect/all-versions/default/NoiseSuppressionEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "NS_Effect_HAL" + +#include "NoiseSuppressionEffect.h" #include @@ -24,7 +26,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { NoiseSuppressionEffect::NoiseSuppressionEffect(effect_handle_t handle) @@ -44,7 +46,7 @@ void NoiseSuppressionEffect::propertiesToHal( halProperties->type = static_cast(properties.type); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return NoiseSuppressionEffect::init() { return mEffect->init(); } @@ -171,7 +173,7 @@ Return NoiseSuppressionEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::INoiseSuppressionEffect +// Methods from ::android::hardware::audio::effect::CPP_VERSION::INoiseSuppressionEffect // follow. Return NoiseSuppressionEffect::setSuppressionLevel(INoiseSuppressionEffect::Level level) { return mEffect->setParam(NS_PARAM_LEVEL, static_cast(level)); @@ -212,7 +214,7 @@ Return NoiseSuppressionEffect::getAllProperties(getAllProperties_cb _hidl_ } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.h b/audio/effect/all-versions/default/NoiseSuppressionEffect.h similarity index 77% rename from audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.h rename to audio/effect/all-versions/default/NoiseSuppressionEffect.h index c70d768219..af62dd1af4 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.h +++ b/audio/effect/all-versions/default/NoiseSuppressionEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_NOISESUPPRESSIONEFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_NOISESUPPRESSIONEFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/INoiseSuppressionEffect.h) + +#include "Effect.h" #include @@ -28,7 +33,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -36,23 +41,23 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::INoiseSuppressionEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; +using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; +using ::android::hardware::audio::effect::CPP_VERSION::IEffect; +using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; +using ::android::hardware::audio::effect::CPP_VERSION::INoiseSuppressionEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct NoiseSuppressionEffect : public INoiseSuppressionEffect { explicit NoiseSuppressionEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -96,7 +101,7 @@ struct NoiseSuppressionEffect : public INoiseSuppressionEffect { const hidl_vec& configData) override; Return close() override; - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::INoiseSuppressionEffect + // Methods from ::android::hardware::audio::effect::CPP_VERSION::INoiseSuppressionEffect // follow. Return setSuppressionLevel(INoiseSuppressionEffect::Level level) override; Return getSuppressionLevel(getSuppressionLevel_cb _hidl_cb) override; @@ -118,8 +123,10 @@ struct NoiseSuppressionEffect : public INoiseSuppressionEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_NOISESUPPRESSIONEFFECT_H diff --git a/audio/core/2.0/default/OWNERS b/audio/effect/all-versions/default/OWNERS similarity index 100% rename from audio/core/2.0/default/OWNERS rename to audio/effect/all-versions/default/OWNERS diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.impl.h b/audio/effect/all-versions/default/PresetReverbEffect.cpp similarity index 94% rename from audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.impl.h rename to audio/effect/all-versions/default/PresetReverbEffect.cpp index eab68fb703..97723f5fbb 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.impl.h +++ b/audio/effect/all-versions/default/PresetReverbEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "PresetReverb_HAL" + +#include "PresetReverbEffect.h" #include #include @@ -25,14 +27,14 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { PresetReverbEffect::PresetReverbEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {} PresetReverbEffect::~PresetReverbEffect() {} -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return PresetReverbEffect::init() { return mEffect->init(); } @@ -159,7 +161,7 @@ Return PresetReverbEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IPresetReverbEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IPresetReverbEffect follow. Return PresetReverbEffect::setPreset(IPresetReverbEffect::Preset preset) { return mEffect->setParam(REVERB_PARAM_PRESET, static_cast(preset)); } @@ -172,7 +174,7 @@ Return PresetReverbEffect::getPreset(getPreset_cb _hidl_cb) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.h b/audio/effect/all-versions/default/PresetReverbEffect.h similarity index 75% rename from audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.h rename to audio/effect/all-versions/default/PresetReverbEffect.h index e5d77f00f0..aa864b0b55 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.h +++ b/audio/effect/all-versions/default/PresetReverbEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_PRESETREVERBEFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_PRESETREVERBEFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IPresetReverbEffect.h) + +#include "Effect.h" #include @@ -26,7 +31,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -34,23 +39,23 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IPresetReverbEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; +using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; +using ::android::hardware::audio::effect::CPP_VERSION::IEffect; +using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; +using ::android::hardware::audio::effect::CPP_VERSION::IPresetReverbEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct PresetReverbEffect : public IPresetReverbEffect { explicit PresetReverbEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -94,7 +99,7 @@ struct PresetReverbEffect : public IPresetReverbEffect { const hidl_vec& configData) override; Return close() override; - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IPresetReverbEffect + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IPresetReverbEffect // follow. Return setPreset(IPresetReverbEffect::Preset preset) override; Return getPreset(getPreset_cb _hidl_cb) override; @@ -106,8 +111,10 @@ struct PresetReverbEffect : public IPresetReverbEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_PRESETREVERBEFFECT_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.impl.h b/audio/effect/all-versions/default/VirtualizerEffect.cpp similarity index 96% rename from audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.impl.h rename to audio/effect/all-versions/default/VirtualizerEffect.cpp index 23b09a89dd..4d597c76e8 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.impl.h +++ b/audio/effect/all-versions/default/VirtualizerEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "Virtualizer_HAL" + +#include "VirtualizerEffect.h" #include @@ -27,7 +29,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { VirtualizerEffect::VirtualizerEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {} @@ -44,7 +46,7 @@ void VirtualizerEffect::speakerAnglesFromHal(const int32_t* halAngles, uint32_t } } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return VirtualizerEffect::init() { return mEffect->init(); } @@ -171,7 +173,7 @@ Return VirtualizerEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVirtualizerEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IVirtualizerEffect follow. Return VirtualizerEffect::isStrengthSupported() { bool halSupported = false; mEffect->getParam(VIRTUALIZER_PARAM_STRENGTH_SUPPORTED, halSupported); @@ -224,7 +226,7 @@ Return VirtualizerEffect::getVirtualizationMode(getVirtualizationMode_cb _ } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.h b/audio/effect/all-versions/default/VirtualizerEffect.h similarity index 75% rename from audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.h rename to audio/effect/all-versions/default/VirtualizerEffect.h index 544db1eb8f..87b53d66ab 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.h +++ b/audio/effect/all-versions/default/VirtualizerEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VIRTUALIZEREFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_VIRTUALIZEREFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IVirtualizerEffect.h) + +#include "Effect.h" #include @@ -26,7 +31,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -34,25 +39,25 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVirtualizerEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield; +using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; +using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; +using ::android::hardware::audio::effect::CPP_VERSION::IEffect; +using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; +using ::android::hardware::audio::effect::CPP_VERSION::IVirtualizerEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct VirtualizerEffect : public IVirtualizerEffect { explicit VirtualizerEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -96,7 +101,7 @@ struct VirtualizerEffect : public IVirtualizerEffect { const hidl_vec& configData) override; Return close() override; - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVirtualizerEffect + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IVirtualizerEffect // follow. Return isStrengthSupported() override; Return setStrength(uint16_t strength) override; @@ -116,8 +121,10 @@ struct VirtualizerEffect : public IVirtualizerEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_VIRTUALIZEREFFECT_H diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.impl.h b/audio/effect/all-versions/default/VisualizerEffect.cpp similarity index 96% rename from audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.impl.h rename to audio/effect/all-versions/default/VisualizerEffect.cpp index 9f2195b5cb..77bf46bcd3 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.impl.h +++ b/audio/effect/all-versions/default/VisualizerEffect.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,9 @@ * limitations under the License. */ -#include +#define LOG_TAG "Visualizer_HAL" + +#include "VisualizerEffect.h" #include #include @@ -25,7 +27,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { VisualizerEffect::VisualizerEffect(effect_handle_t handle) @@ -33,7 +35,7 @@ VisualizerEffect::VisualizerEffect(effect_handle_t handle) VisualizerEffect::~VisualizerEffect() {} -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return VisualizerEffect::init() { return mEffect->init(); } @@ -160,7 +162,7 @@ Return VisualizerEffect::close() { return mEffect->close(); } -// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVisualizerEffect follow. +// Methods from ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect follow. Return VisualizerEffect::setCaptureSize(uint16_t captureSize) { Result retval = mEffect->setParam(VISUALIZER_PARAM_CAPTURE_SIZE, captureSize); if (retval == Result::OK) { @@ -247,7 +249,7 @@ Return VisualizerEffect::measure(measure_cb _hidl_cb) { } } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.h b/audio/effect/all-versions/default/VisualizerEffect.h similarity index 77% rename from audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.h rename to audio/effect/all-versions/default/VisualizerEffect.h index e207fc0bb1..0a13a2bf1f 100644 --- a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.h +++ b/audio/effect/all-versions/default/VisualizerEffect.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,7 +14,12 @@ * limitations under the License. */ -#include +#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H +#define ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H + +#include PATH(android/hardware/audio/effect/FILE_VERSION/IVisualizerEffect.h) + +#include "Effect.h" #include @@ -26,7 +31,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace AUDIO_HAL_VERSION { +namespace CPP_VERSION { namespace implementation { using ::android::sp; @@ -34,23 +39,23 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; -using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVisualizerEffect; -using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::common::CPP_VERSION::AudioDevice; +using ::android::hardware::audio::common::CPP_VERSION::AudioMode; +using ::android::hardware::audio::common::CPP_VERSION::AudioSource; +using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer; +using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig; +using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; +using ::android::hardware::audio::effect::CPP_VERSION::IEffect; +using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback; +using ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect; +using ::android::hardware::audio::effect::CPP_VERSION::Result; struct VisualizerEffect : public IVisualizerEffect { explicit VisualizerEffect(effect_handle_t handle); - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. Return init() override; Return setConfig( const EffectConfig& config, const sp& inputBufferProvider, @@ -94,7 +99,7 @@ struct VisualizerEffect : public IVisualizerEffect { const hidl_vec& configData) override; Return close() override; - // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVisualizerEffect follow. + // Methods from ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect follow. Return setCaptureSize(uint16_t captureSize) override; Return getCaptureSize(getCaptureSize_cb _hidl_cb) override; Return setScalingMode(IVisualizerEffect::ScalingMode scalingMode) override; @@ -115,8 +120,10 @@ struct VisualizerEffect : public IVisualizerEffect { }; } // namespace implementation -} // namespace AUDIO_HAL_VERSION +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware } // namespace android + +#endif // ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H diff --git a/audio/effect/2.0/vts/OWNERS b/audio/effect/all-versions/vts/OWNERS similarity index 79% rename from audio/effect/2.0/vts/OWNERS rename to audio/effect/all-versions/vts/OWNERS index 8711a9ff6a..0ea4666443 100644 --- a/audio/effect/2.0/vts/OWNERS +++ b/audio/effect/all-versions/vts/OWNERS @@ -2,4 +2,4 @@ elaurent@google.com krocard@google.com mnaganov@google.com yim@google.com -zhuoyao@google.com \ No newline at end of file +zhuoyao@google.com diff --git a/audio/effect/4.0/vts/functional/Android.bp b/audio/effect/all-versions/vts/functional/Android.bp similarity index 57% rename from audio/effect/4.0/vts/functional/Android.bp rename to audio/effect/all-versions/vts/functional/Android.bp index 4589e5181a..a379d292c0 100644 --- a/audio/effect/4.0/vts/functional/Android.bp +++ b/audio/effect/all-versions/vts/functional/Android.bp @@ -14,6 +14,35 @@ // limitations under the License. // +cc_test { + name: "VtsHalAudioEffectV2_0TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "VtsHalAudioEffectTargetTest.cpp", + "ValidateAudioEffectsConfiguration.cpp" + ], + static_libs: [ + "android.hardware.audio.common.test.utility", + "android.hardware.audio.common@2.0", + "android.hardware.audio.effect@2.0", + "android.hidl.allocator@1.0", + "android.hidl.memory@1.0", + "libeffectsconfig", + "libicuuc", + "libicuuc_stubdata", + "libxml2", + ], + header_libs: [ + "android.hardware.audio.common.util@all-versions", + ], + test_suites: ["general-tests"], + cflags: [ + "-DMAJOR_VERSION=2", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] +} + cc_test { name: "VtsHalAudioEffectV4_0TargetTest", defaults: ["VtsHalTargetTestDefaults"], @@ -36,4 +65,9 @@ cc_test { "android.hardware.audio.common.util@all-versions", ], test_suites: ["general-tests"], + cflags: [ + "-DMAJOR_VERSION=4", + "-DMINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ] } diff --git a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp b/audio/effect/all-versions/vts/functional/ValidateAudioEffectsConfiguration.cpp similarity index 83% rename from audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp rename to audio/effect/all-versions/vts/functional/ValidateAudioEffectsConfiguration.cpp index 040c93fe49..9f45ce2a53 100644 --- a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp +++ b/audio/effect/all-versions/vts/functional/ValidateAudioEffectsConfiguration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. @@ -25,15 +25,18 @@ #define QUOTE(x) #x #define STRINGIFY(x) QUOTE(x) -#define AUDIO_HAL_VERSION V2_0 - TEST(CheckConfig, audioEffectsConfigurationValidation) { RecordProperty("description", "Verify that the effects configuration file is valid according to the schema"); using namespace android::effectsConfig; std::vector locations(std::begin(DEFAULT_LOCATIONS), std::end(DEFAULT_LOCATIONS)); - const char* xsd = "/data/local/tmp/audio_effects_conf_" STRINGIFY(AUDIO_HAL_VERSION) ".xsd"; + const char* xsd = "/data/local/tmp/audio_effects_conf_" STRINGIFY(CPP_VERSION) ".xsd"; +#if MAJOR_VERSION == 2 // In V2, audio effect XML is not required. .conf is still allowed though deprecated EXPECT_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, xsd); +#elif MAJOR_VERSION == 4 + // Starting with V4, audio effect XML is required + EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, xsd); +#endif } diff --git a/audio/effect/4.0/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp similarity index 94% rename from audio/effect/4.0/vts/functional/VtsHalAudioEffectTargetTest.cpp rename to audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp index 96b8602dfb..c248eae549 100644 --- a/audio/effect/4.0/vts/functional/VtsHalAudioEffectTargetTest.cpp +++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 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. @@ -18,11 +18,11 @@ #include #include -#include -#include -#include -#include -#include +#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffect.h) +#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffectsFactory.h) +#include PATH(android/hardware/audio/effect/FILE_VERSION/IEqualizerEffect.h) +#include PATH(android/hardware/audio/effect/FILE_VERSION/ILoudnessEnhancerEffect.h) +#include PATH(android/hardware/audio/effect/FILE_VERSION/types.h) #include #include @@ -39,23 +39,23 @@ using android::hardware::hidl_vec; using android::hardware::MQDescriptorSync; using android::hardware::Return; using android::hardware::Void; +using android::hardware::audio::common::CPP_VERSION::AudioDevice; +using android::hardware::audio::common::CPP_VERSION::AudioHandleConsts; +using android::hardware::audio::common::CPP_VERSION::AudioMode; +using android::hardware::audio::common::CPP_VERSION::AudioSource; +using android::hardware::audio::common::CPP_VERSION::Uuid; using android::hardware::audio::common::utils::mkEnumBitfield; -using android::hardware::audio::common::V4_0::AudioDevice; -using android::hardware::audio::common::V4_0::AudioHandleConsts; -using android::hardware::audio::common::V4_0::AudioMode; -using android::hardware::audio::common::V4_0::AudioSource; -using android::hardware::audio::common::V4_0::Uuid; -using android::hardware::audio::effect::V4_0::AudioBuffer; -using android::hardware::audio::effect::V4_0::EffectAuxChannelsConfig; -using android::hardware::audio::effect::V4_0::EffectBufferConfig; -using android::hardware::audio::effect::V4_0::EffectConfig; -using android::hardware::audio::effect::V4_0::EffectDescriptor; -using android::hardware::audio::effect::V4_0::EffectOffloadParameter; -using android::hardware::audio::effect::V4_0::IEffect; -using android::hardware::audio::effect::V4_0::IEffectsFactory; -using android::hardware::audio::effect::V4_0::IEqualizerEffect; -using android::hardware::audio::effect::V4_0::ILoudnessEnhancerEffect; -using android::hardware::audio::effect::V4_0::Result; +using android::hardware::audio::effect::CPP_VERSION::AudioBuffer; +using android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig; +using android::hardware::audio::effect::CPP_VERSION::EffectBufferConfig; +using android::hardware::audio::effect::CPP_VERSION::EffectConfig; +using android::hardware::audio::effect::CPP_VERSION::EffectDescriptor; +using android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter; +using android::hardware::audio::effect::CPP_VERSION::IEffect; +using android::hardware::audio::effect::CPP_VERSION::IEffectsFactory; +using android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect; +using android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect; +using android::hardware::audio::effect::CPP_VERSION::Result; using android::hidl::allocator::V1_0::IAllocator; using android::hidl::memory::V1_0::IMemory; @@ -162,7 +162,11 @@ TEST_F(AudioEffectsFactoryHidlTest, GetDescriptor) { TEST_F(AudioEffectsFactoryHidlTest, DebugDumpInvalidArgument) { description("Verify that debugDump doesn't crash on invalid arguments"); +#if MAJOR_VERSION == 2 + Return ret = effectsFactory->debugDump(hidl_handle()); +#elif MAJOR_VERSION == 4 Return ret = effectsFactory->debug(hidl_handle(), {}); +#endif ASSERT_TRUE(ret.isOk()); } @@ -338,7 +342,7 @@ namespace android { namespace hardware { namespace audio { namespace effect { -namespace V4_0 { +namespace CPP_VERSION { inline bool operator==(const AudioBuffer& lhs, const AudioBuffer& rhs) { return lhs.id == rhs.id && lhs.frameCount == rhs.frameCount && lhs.data.handle() == nullptr && rhs.data.handle() == nullptr; @@ -353,7 +357,7 @@ inline bool operator==(const EffectBufferConfig& lhs, const EffectBufferConfig& inline bool operator==(const EffectConfig& lhs, const EffectConfig& rhs) { return lhs.inputCfg == rhs.inputCfg && lhs.outputCfg == rhs.outputCfg; } -} // namespace V4_0 +} // namespace CPP_VERSION } // namespace effect } // namespace audio } // namespace hardware @@ -737,7 +741,8 @@ TEST_F(EqualizerAudioEffectHidlTest, GetSetAllProperties) { description( "Verify that setting band levels and presets works via Get / " "SetAllProperties for Equalizer effect"); - using AllProperties = android::hardware::audio::effect::V4_0::IEqualizerEffect::AllProperties; + using AllProperties = + android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect::AllProperties; uint16_t numBands = 0; getNumBands(&numBands); ASSERT_GT(numBands, 0);