From 8140f5660a6cd15d3e947cb52e6b305c36313151 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Sat, 15 Jan 2022 01:15:12 +0000 Subject: [PATCH] Audio HAL V7.1: Update the default implementation Split versions of "common" and "core" types from the version of the interfaces. "Common" and "core" versions are set to 7.0. Implemented new methods of V7.1 interfaces. Bug: 214426419 Test: m android.hardware.audio@7.1-impl Test: m android.hardware.audio@7.0-impl Test: m android.hardware.audio.effect@7.0-impl Test: m android.hardware.audio@6.0-impl Change-Id: Ic4c44d4ac9bbfa7b62695866b9aa7473658390b2 (cherry picked from commit 7d01538eeccf81aa57da61b4abba830d34582195) Merged-In: Ic4c44d4ac9bbfa7b62695866b9aa7473658390b2 --- .../all-versions/default/7.0/HidlUtils.cpp | 8 +- audio/common/all-versions/default/HidlUtils.h | 10 +- audio/common/all-versions/default/UuidUtils.h | 4 +- .../all-versions/default/VersionUtils.h | 25 +++- .../all-versions/default/service/service.cpp | 1 + .../common/all-versions/VersionMacro.h | 28 ++++ audio/core/all-versions/default/Android.bp | 26 ++++ audio/core/all-versions/default/Device.cpp | 141 ++++++++++++------ .../all-versions/default/DevicesFactory.cpp | 38 ++++- .../all-versions/default/ParametersUtil.cpp | 4 +- .../all-versions/default/PrimaryDevice.cpp | 8 +- audio/core/all-versions/default/Stream.cpp | 6 +- audio/core/all-versions/default/StreamIn.cpp | 8 +- audio/core/all-versions/default/StreamOut.cpp | 8 +- .../default/include/core/default/Device.h | 38 ++++- .../include/core/default/DevicesFactory.h | 8 +- .../include/core/default/ParametersUtil.h | 13 +- .../include/core/default/PrimaryDevice.h | 9 +- .../default/include/core/default/Stream.h | 11 +- .../default/include/core/default/StreamIn.h | 3 +- .../default/include/core/default/StreamOut.h | 3 +- .../default/include/core/default/Util.h | 16 +- .../all-versions/default/util/CoreUtils.cpp | 12 +- .../default/util/include/util/CoreUtils.h | 12 +- audio/effect/all-versions/default/Effect.cpp | 5 +- audio/effect/all-versions/default/Effect.h | 5 +- .../all-versions/default/EffectsFactory.cpp | 2 +- .../all-versions/default/EffectsFactory.h | 2 +- .../default/EnvironmentalReverbEffect.h | 2 +- .../all-versions/default/EqualizerEffect.h | 2 +- .../default/LoudnessEnhancerEffect.h | 2 +- .../default/NoiseSuppressionEffect.h | 2 +- .../all-versions/default/PresetReverbEffect.h | 2 +- .../default/VirtualizerEffect.cpp | 2 +- .../all-versions/default/VirtualizerEffect.h | 5 +- .../all-versions/default/VisualizerEffect.h | 2 +- .../all-versions/default/util/EffectUtils.cpp | 6 +- .../compatibility_matrix.current.xml | 2 +- 38 files changed, 355 insertions(+), 126 deletions(-) diff --git a/audio/common/all-versions/default/7.0/HidlUtils.cpp b/audio/common/all-versions/default/7.0/HidlUtils.cpp index 5a5b5d276a..218d7c06b7 100644 --- a/audio/common/all-versions/default/7.0/HidlUtils.cpp +++ b/audio/common/all-versions/default/7.0/HidlUtils.cpp @@ -21,7 +21,7 @@ #define LOG_TAG "HidlUtils" #include -#include +#include PATH(APM_XSD_ENUMS_H_FILENAME) #include #include @@ -31,11 +31,11 @@ namespace android { namespace hardware { namespace audio { namespace common { -namespace CPP_VERSION { +namespace COMMON_TYPES_CPP_VERSION { namespace implementation { namespace xsd { -using namespace ::android::audio::policy::configuration::V7_0; +using namespace ::android::audio::policy::configuration::CPP_VERSION; } #define CONVERT_CHECKED(expr, result) \ @@ -1151,7 +1151,7 @@ status_t HidlUtils::deviceAddressToHal(const DeviceAddress& device, audio_device } } // namespace implementation -} // namespace CPP_VERSION +} // namespace COMMON_TYPES_CPP_VERSION } // namespace common } // namespace audio } // namespace hardware diff --git a/audio/common/all-versions/default/HidlUtils.h b/audio/common/all-versions/default/HidlUtils.h index 98ecc0754e..ad9dee22c1 100644 --- a/audio/common/all-versions/default/HidlUtils.h +++ b/audio/common/all-versions/default/HidlUtils.h @@ -17,7 +17,9 @@ #ifndef android_hardware_audio_Hidl_Utils_H_ #define android_hardware_audio_Hidl_Utils_H_ -#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) +// clang-format off +#include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h) +// clang-format on #include #include @@ -29,11 +31,11 @@ namespace android { namespace hardware { namespace audio { namespace common { -namespace CPP_VERSION { +namespace COMMON_TYPES_CPP_VERSION { namespace implementation { using ::android::hardware::hidl_vec; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; struct HidlUtils { static status_t audioConfigFromHal(const audio_config_t& halConfig, bool isInput, @@ -267,7 +269,7 @@ status_t HidlUtils::deviceAddressFromHalImpl(audio_devices_t halDeviceType, #endif // MAJOR_VERSION <= 6 } // namespace implementation -} // namespace CPP_VERSION +} // namespace COMMON_TYPES_CPP_VERSION } // namespace common } // namespace audio } // namespace hardware diff --git a/audio/common/all-versions/default/UuidUtils.h b/audio/common/all-versions/default/UuidUtils.h index cd04fb039a..4a64f0a570 100644 --- a/audio/common/all-versions/default/UuidUtils.h +++ b/audio/common/all-versions/default/UuidUtils.h @@ -20,7 +20,7 @@ #include // clang-format off -#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h) // clang-format on #include @@ -32,7 +32,7 @@ namespace common { namespace CPP_VERSION { namespace implementation { -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; class UuidUtils { public: diff --git a/audio/common/all-versions/default/VersionUtils.h b/audio/common/all-versions/default/VersionUtils.h index 9bfca0cdcc..9771374c33 100644 --- a/audio/common/all-versions/default/VersionUtils.h +++ b/audio/common/all-versions/default/VersionUtils.h @@ -17,7 +17,30 @@ #ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H #define ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H -#include PATH(android/hardware/audio/common/FILE_VERSION/types.h) +// A workaround for b/216149583 (vendor code having its own copy of VersionMacro.h) +#ifndef COMMON_TYPES_MINOR_VERSION +#define COMMON_TYPES_MINOR_VERSION MINOR_VERSION +#endif +#ifndef CORE_TYPES_MINOR_VERSION +#define CORE_TYPES_MINOR_VERSION MINOR_VERSION +#endif +#ifndef COMMON_TYPES_FILE_VERSION +#define COMMON_TYPES_FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., COMMON_TYPES_MINOR_VERSION) +#endif +#ifndef CORE_TYPES_FILE_VERSION +#define CORE_TYPES_FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., CORE_TYPES_MINOR_VERSION) +#endif +#ifndef COMMON_TYPES_CPP_VERSION +#define COMMON_TYPES_CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, COMMON_TYPES_MINOR_VERSION) +#endif +#ifndef CORE_TYPES_CPP_VERSION +#define CORE_TYPES_CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, CORE_TYPES_MINOR_VERSION) +#endif +// End of workaround + +// clang-format off +#include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h) +// clang-format on namespace android { namespace hardware { diff --git a/audio/common/all-versions/default/service/service.cpp b/audio/common/all-versions/default/service/service.cpp index 89585b0620..e26369fd70 100644 --- a/audio/common/all-versions/default/service/service.cpp +++ b/audio/common/all-versions/default/service/service.cpp @@ -66,6 +66,7 @@ int main(int /* argc */, char* /* argv */ []) { const std::vector mandatoryInterfaces = { { "Audio Core API", + "android.hardware.audio@7.1::IDevicesFactory", "android.hardware.audio@7.0::IDevicesFactory", "android.hardware.audio@6.0::IDevicesFactory", "android.hardware.audio@5.0::IDevicesFactory", diff --git a/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h b/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h index dc54cee206..875e167f38 100644 --- a/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h +++ b/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h @@ -21,6 +21,14 @@ #error "MAJOR_VERSION and MINOR_VERSION must be defined" #endif +#ifndef COMMON_TYPES_MINOR_VERSION +#define COMMON_TYPES_MINOR_VERSION MINOR_VERSION +#endif + +#ifndef CORE_TYPES_MINOR_VERSION +#define CORE_TYPES_MINOR_VERSION MINOR_VERSION +#endif + /** Allows macro expansion for x and add surrounding `<>`. * Is intended to be used for version dependant includes as * `#include` do not macro expand if starting with < or " @@ -34,10 +42,30 @@ #define EXPAND_CONCAT_3(a, b, c) CONCAT_3(a, b, c) /** The directory name of the version: . */ #define FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., MINOR_VERSION) +#define COMMON_TYPES_FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., COMMON_TYPES_MINOR_VERSION) +#define CORE_TYPES_FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., CORE_TYPES_MINOR_VERSION) #define CONCAT_4(a, b, c, d) a##b##c##d #define EXPAND_CONCAT_4(a, b, c, d) CONCAT_4(a, b, c, d) /** The c++ namespace of the version: V_ */ #define CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, MINOR_VERSION) +#define COMMON_TYPES_CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, COMMON_TYPES_MINOR_VERSION) +#define CORE_TYPES_CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, CORE_TYPES_MINOR_VERSION) + +/* Gluing these file names from macros is non-trivial due to "illegal tokens" + occurring during expansion. The XSD and enums always use the minor version. */ +// clang-format off +#if MAJOR_VERSION >= 7 +#if MINOR_VERSION == 0 +#define APM_XSD_H_FILENAME android_audio_policy_configuration_V7_0.h +#define APM_XSD_ENUMS_H_FILENAME android_audio_policy_configuration_V7_0-enums.h +#elif MINOR_VERSION == 1 +#define APM_XSD_H_FILENAME android_audio_policy_configuration_V7_1.h +#define APM_XSD_ENUMS_H_FILENAME android_audio_policy_configuration_V7_1-enums.h +#else +#error "Unsupported minor version" +#endif +#endif +// clang-format on #endif // ANDROID_HARDWARE_VERSION_MACRO_H diff --git a/audio/core/all-versions/default/Android.bp b/audio/core/all-versions/default/Android.bp index 8fb7111fbf..86380a5d40 100644 --- a/audio/core/all-versions/default/Android.bp +++ b/audio/core/all-versions/default/Android.bp @@ -159,3 +159,29 @@ cc_library_shared { name: "android.hardware.audio@7.0-impl", defaults: ["android.hardware.audio@7.0-impl_default"], } + +cc_defaults { + name: "android.hardware.audio@7.1-impl_default", + defaults: ["android.hardware.audio-impl_default"], + shared_libs: [ + "android.hardware.audio@7.0", + "android.hardware.audio@7.1", + "android.hardware.audio@7.0-util", + "android.hardware.audio.common@7.0", + "android.hardware.audio.common@7.1-enums", + "android.hardware.audio.common@7.0-util", + "libbase", + ], + cflags: [ + "-DMAJOR_VERSION=7", + "-DMINOR_VERSION=1", + "-DCOMMON_TYPES_MINOR_VERSION=0", + "-DCORE_TYPES_MINOR_VERSION=0", + "-include common/all-versions/VersionMacro.h", + ], +} + +cc_library_shared { + name: "android.hardware.audio@7.1-impl", + defaults: ["android.hardware.audio@7.1-impl_default"], +} diff --git a/audio/core/all-versions/default/Device.cpp b/audio/core/all-versions/default/Device.cpp index 130dfba95b..98a59b9ff2 100644 --- a/audio/core/all-versions/default/Device.cpp +++ b/audio/core/all-versions/default/Device.cpp @@ -39,7 +39,10 @@ namespace audio { namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils; +namespace util { +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::util; +} Device::Device(audio_hw_device_t* device) : mIsClosed(false), mDevice(device) {} @@ -82,7 +85,7 @@ Return Device::setMasterVolume(float volume) { if (mDevice->set_master_volume == NULL) { return Result::NOT_SUPPORTED; } - if (!isGainNormalized(volume)) { + if (!util::isGainNormalized(volume)) { ALOGW("Can not set a master volume (%f) outside [0,1]", volume); return Result::INVALID_ARGUMENTS; } @@ -148,7 +151,7 @@ Return Device::getInputBufferSize(const AudioConfig& config, getInputBuffe return Void(); } -std::tuple> Device::openOutputStreamImpl(int32_t ioHandle, +std::tuple> Device::openOutputStreamCore(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, const AudioOutputFlags& flags, @@ -185,7 +188,7 @@ std::tuple> Device::openOutputStreamImpl(int32_t ioHandle return {analyzeStatus("open_output_stream", status, {EINVAL} /*ignore*/), streamOut}; } -std::tuple> Device::openInputStreamImpl( +std::tuple> Device::openInputStreamCore( int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, const AudioInputFlags& flags, AudioSource source, AudioConfig* suggestedConfig) { audio_config_t halConfig; @@ -228,7 +231,7 @@ Return Device::openOutputStream(int32_t ioHandle, const DeviceAddress& dev openOutputStream_cb _hidl_cb) { AudioConfig suggestedConfig; auto [result, streamOut] = - openOutputStreamImpl(ioHandle, device, config, flags, &suggestedConfig); + openOutputStreamCore(ioHandle, device, config, flags, &suggestedConfig); _hidl_cb(result, streamOut, suggestedConfig); return Void(); } @@ -238,12 +241,36 @@ Return Device::openInputStream(int32_t ioHandle, const DeviceAddress& devi AudioSource source, openInputStream_cb _hidl_cb) { AudioConfig suggestedConfig; auto [result, streamIn] = - openInputStreamImpl(ioHandle, device, config, flags, source, &suggestedConfig); + openInputStreamCore(ioHandle, device, config, flags, source, &suggestedConfig); _hidl_cb(result, streamIn, suggestedConfig); return Void(); } #elif MAJOR_VERSION >= 4 +std::tuple, AudioConfig> Device::openOutputStreamImpl( + int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, + const SourceMetadata& sourceMetadata, +#if MAJOR_VERSION <= 6 + AudioOutputFlags flags) { + if (status_t status = CoreUtils::sourceMetadataToHal(sourceMetadata, nullptr); + status != NO_ERROR) { +#else + const AudioOutputFlags& flags) { + if (status_t status = CoreUtils::sourceMetadataToHalV7(sourceMetadata, + false /*ignoreNonVendorTags*/, nullptr); + status != NO_ERROR) { +#endif + return {analyzeStatus("sourceMetadataToHal", status), nullptr, {}}; + } + AudioConfig suggestedConfig; + auto [result, streamOut] = + openOutputStreamCore(ioHandle, device, config, flags, &suggestedConfig); + if (streamOut) { + streamOut->updateSourceMetadata(sourceMetadata); + } + return {result, streamOut, suggestedConfig}; +} + Return Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, #if MAJOR_VERSION <= 6 @@ -253,27 +280,46 @@ Return Device::openOutputStream(int32_t ioHandle, const DeviceAddress& dev #endif const SourceMetadata& sourceMetadata, openOutputStream_cb _hidl_cb) { -#if MAJOR_VERSION <= 6 - if (status_t status = CoreUtils::sourceMetadataToHal(sourceMetadata, nullptr); - status != NO_ERROR) { -#else - if (status_t status = CoreUtils::sourceMetadataToHalV7(sourceMetadata, - false /*ignoreNonVendorTags*/, nullptr); - status != NO_ERROR) { -#endif - _hidl_cb(analyzeStatus("sourceMetadataToHal", status), nullptr, AudioConfig{}); - return Void(); - } - AudioConfig suggestedConfig; - auto [result, streamOut] = - openOutputStreamImpl(ioHandle, device, config, flags, &suggestedConfig); - if (streamOut) { - streamOut->updateSourceMetadata(sourceMetadata); - } + auto [result, streamOut, suggestedConfig] = + openOutputStreamImpl(ioHandle, device, config, sourceMetadata, flags); _hidl_cb(result, streamOut, suggestedConfig); return Void(); } +std::tuple, AudioConfig> Device::openInputStreamImpl( + int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, +#if MAJOR_VERSION <= 6 + AudioInputFlags flags, +#else + const AudioInputFlags& flags, +#endif + const SinkMetadata& sinkMetadata) { + if (sinkMetadata.tracks.size() == 0) { + // This should never happen, the framework must not create as stream + // if there is no client + ALOGE("openInputStream called without tracks connected"); + return {Result::INVALID_ARGUMENTS, nullptr, AudioConfig{}}; + } +#if MAJOR_VERSION <= 6 + if (status_t status = CoreUtils::sinkMetadataToHal(sinkMetadata, nullptr); status != NO_ERROR) { +#else + if (status_t status = CoreUtils::sinkMetadataToHalV7(sinkMetadata, + false /*ignoreNonVendorTags*/, nullptr); + status != NO_ERROR) { +#endif + return {analyzeStatus("sinkMetadataToHal", status), nullptr, AudioConfig{}}; + } + // Pick the first one as the main. + AudioSource source = sinkMetadata.tracks[0].source; + AudioConfig suggestedConfig; + auto [result, streamIn] = + openInputStreamCore(ioHandle, device, config, flags, source, &suggestedConfig); + if (streamIn) { + streamIn->updateSinkMetadata(sinkMetadata); + } + return {result, streamIn, suggestedConfig}; +} + Return Device::openInputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, #if MAJOR_VERSION <= 6 @@ -283,36 +329,35 @@ Return Device::openInputStream(int32_t ioHandle, const DeviceAddress& devi #endif const SinkMetadata& sinkMetadata, openInputStream_cb _hidl_cb) { - if (sinkMetadata.tracks.size() == 0) { - // This should never happen, the framework must not create as stream - // if there is no client - ALOGE("openInputStream called without tracks connected"); - _hidl_cb(Result::INVALID_ARGUMENTS, nullptr, AudioConfig{}); - return Void(); - } -#if MAJOR_VERSION <= 6 - if (status_t status = CoreUtils::sinkMetadataToHal(sinkMetadata, nullptr); status != NO_ERROR) { -#else - if (status_t status = CoreUtils::sinkMetadataToHalV7(sinkMetadata, - false /*ignoreNonVendorTags*/, nullptr); - status != NO_ERROR) { -#endif - _hidl_cb(analyzeStatus("sinkMetadataToHal", status), nullptr, AudioConfig{}); - return Void(); - } - // Pick the first one as the main. - AudioSource source = sinkMetadata.tracks[0].source; - AudioConfig suggestedConfig; - auto [result, streamIn] = - openInputStreamImpl(ioHandle, device, config, flags, source, &suggestedConfig); - if (streamIn) { - streamIn->updateSinkMetadata(sinkMetadata); - } + auto [result, streamIn, suggestedConfig] = + openInputStreamImpl(ioHandle, device, config, flags, sinkMetadata); _hidl_cb(result, streamIn, suggestedConfig); return Void(); } #endif /* MAJOR_VERSION */ +#if MAJOR_VERSION == 7 && MINOR_VERSION == 1 +Return Device::openOutputStream_7_1(int32_t ioHandle, const DeviceAddress& device, + const AudioConfig& config, const AudioOutputFlags& flags, + const SourceMetadata& sourceMetadata, + openOutputStream_7_1_cb _hidl_cb) { + auto [result, streamOut, suggestedConfig] = + openOutputStreamImpl(ioHandle, device, config, sourceMetadata, flags); + _hidl_cb(result, streamOut, suggestedConfig); + return Void(); +} + +Return Device::openInputStream_7_1(int32_t ioHandle, const DeviceAddress& device, + const AudioConfig& config, const AudioInputFlags& flags, + const SinkMetadata& sinkMetadata, + openInputStream_7_1_cb _hidl_cb) { + auto [result, streamIn, suggestedConfig] = + openInputStreamImpl(ioHandle, device, config, flags, sinkMetadata); + _hidl_cb(result, streamIn, suggestedConfig); + return Void(); +} +#endif // V7.1 + Return Device::supportsAudioPatches() { return version() >= AUDIO_DEVICE_API_VERSION_3_0; } diff --git a/audio/core/all-versions/default/DevicesFactory.cpp b/audio/core/all-versions/default/DevicesFactory.cpp index 729f18cf91..f44daf0b0e 100644 --- a/audio/core/all-versions/default/DevicesFactory.cpp +++ b/audio/core/all-versions/default/DevicesFactory.cpp @@ -47,22 +47,54 @@ Return DevicesFactory::openDevice(IDevicesFactory::Device device, openDevi _hidl_cb(Result::INVALID_ARGUMENTS, nullptr); return Void(); } + +Return DevicesFactory::openDevice(const char* moduleName, openDevice_cb _hidl_cb) { + return openDevice(moduleName, _hidl_cb); +} #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); } - return openDevice(moduleName.c_str(), _hidl_cb); + return openDevice(moduleName.c_str(), _hidl_cb); } Return DevicesFactory::openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) { return openDevice(AUDIO_HARDWARE_MODULE_ID_PRIMARY, _hidl_cb); } #endif -Return DevicesFactory::openDevice(const char* moduleName, openDevice_cb _hidl_cb) { - return openDevice(moduleName, _hidl_cb); +#if MAJOR_VERSION == 7 && MINOR_VERSION == 1 +Return DevicesFactory::openDevice_7_1(const hidl_string& moduleName, + openDevice_7_1_cb _hidl_cb) { + if (moduleName == AUDIO_HARDWARE_MODULE_ID_PRIMARY) { + Result result; + sp primary; + auto ret = openDevice( + AUDIO_HARDWARE_MODULE_ID_PRIMARY, + [&result, &primary](Result r, const sp& p) { + result = r; + primary = p; + }); + if (ret.isOk() && result == Result::OK && primary != nullptr) { + auto getDeviceRet = primary->getDevice(); + if (getDeviceRet.isOk()) { + _hidl_cb(result, getDeviceRet); + } else { + _hidl_cb(Result::NOT_INITIALIZED, nullptr); + } + } else { + _hidl_cb(result, nullptr); + } + return Void(); + } + return openDevice(moduleName.c_str(), _hidl_cb); } +Return DevicesFactory::openPrimaryDevice_7_1(openPrimaryDevice_7_1_cb _hidl_cb) { + return openDevice(AUDIO_HARDWARE_MODULE_ID_PRIMARY, _hidl_cb); +} +#endif // V7.1 + template Return DevicesFactory::openDevice(const char* moduleName, Callback _hidl_cb) { audio_hw_device_t* halDevice; diff --git a/audio/core/all-versions/default/ParametersUtil.cpp b/audio/core/all-versions/default/ParametersUtil.cpp index 4d536455d4..e21eff2845 100644 --- a/audio/core/all-versions/default/ParametersUtil.cpp +++ b/audio/core/all-versions/default/ParametersUtil.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace audio { -namespace CPP_VERSION { +namespace CORE_TYPES_CPP_VERSION { namespace implementation { /** Converts a status_t in Result according to the rules of AudioParameter::get* @@ -168,7 +168,7 @@ Result ParametersUtil::setParams(const AudioParameter& param) { } } // namespace implementation -} // namespace CPP_VERSION +} // namespace CORE_TYPES_CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/PrimaryDevice.cpp b/audio/core/all-versions/default/PrimaryDevice.cpp index fe56177975..cf162f1463 100644 --- a/audio/core/all-versions/default/PrimaryDevice.cpp +++ b/audio/core/all-versions/default/PrimaryDevice.cpp @@ -29,6 +29,10 @@ namespace audio { namespace CPP_VERSION { namespace implementation { +namespace util { +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::util; +} + PrimaryDevice::PrimaryDevice(audio_hw_device_t* device) : mDevice(new Device(device)) {} PrimaryDevice::~PrimaryDevice() { @@ -195,7 +199,7 @@ Return PrimaryDevice::updateAudioPatch(int32_t previousPatch, // Methods from ::android::hardware::audio::CPP_VERSION::IPrimaryDevice follow. Return PrimaryDevice::setVoiceVolume(float volume) { - if (!isGainNormalized(volume)) { + if (!util::isGainNormalized(volume)) { ALOGW("Can not set a voice volume (%f) outside [0,1]", volume); return Result::INVALID_ARGUMENTS; } @@ -326,7 +330,7 @@ Return PrimaryDevice::setBtHfpSampleRate(uint32_t sampleRateHz) { return mDevice->setParam(AUDIO_PARAMETER_KEY_HFP_SET_SAMPLING_RATE, int(sampleRateHz)); } Return PrimaryDevice::setBtHfpVolume(float volume) { - if (!isGainNormalized(volume)) { + if (!util::isGainNormalized(volume)) { ALOGW("Can not set BT HFP volume (%f) outside [0,1]", volume); return Result::INVALID_ARGUMENTS; } diff --git a/audio/core/all-versions/default/Stream.cpp b/audio/core/all-versions/default/Stream.cpp index 7e3257399c..8e85a8b255 100644 --- a/audio/core/all-versions/default/Stream.cpp +++ b/audio/core/all-versions/default/Stream.cpp @@ -37,8 +37,12 @@ namespace audio { namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils; using ::android::hardware::audio::common::utils::splitString; +using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::CoreUtils; +namespace util { +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::util; +} Stream::Stream(bool isInput, audio_stream_t* stream) : mIsInput(isInput), mStream(stream) { (void)mIsInput; // prevent 'unused field' warnings in pre-V7 versions. diff --git a/audio/core/all-versions/default/StreamIn.cpp b/audio/core/all-versions/default/StreamIn.cpp index 2aeee43c59..2bea425f26 100644 --- a/audio/core/all-versions/default/StreamIn.cpp +++ b/audio/core/all-versions/default/StreamIn.cpp @@ -37,7 +37,11 @@ namespace audio { namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::CoreUtils; +namespace util { +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::util; +} namespace { @@ -348,7 +352,7 @@ Return StreamIn::getAudioSource(getAudioSource_cb _hidl_cb) { } Return StreamIn::setGain(float gain) { - if (!isGainNormalized(gain)) { + if (!util::isGainNormalized(gain)) { ALOGW("Can not set a stream input gain (%f) outside [0,1]", gain); return Result::INVALID_ARGUMENTS; } diff --git a/audio/core/all-versions/default/StreamOut.cpp b/audio/core/all-versions/default/StreamOut.cpp index d027231f11..d4a89d7bf9 100644 --- a/audio/core/all-versions/default/StreamOut.cpp +++ b/audio/core/all-versions/default/StreamOut.cpp @@ -39,7 +39,11 @@ namespace audio { namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::CoreUtils; +namespace util { +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::util; +} namespace { @@ -334,7 +338,7 @@ Return StreamOut::setVolume(float left, float right) { if (mStream->set_volume == NULL) { return Result::NOT_SUPPORTED; } - if (!isGainNormalized(left)) { + if (!util::isGainNormalized(left)) { ALOGW("Can not set a stream output volume {%f, %f} outside [0,1]", left, right); return Result::INVALID_ARGUMENTS; } diff --git a/audio/core/all-versions/default/include/core/default/Device.h b/audio/core/all-versions/default/include/core/default/Device.h index 94cad53581..0aeb6b32cb 100644 --- a/audio/core/all-versions/default/include/core/default/Device.h +++ b/audio/core/all-versions/default/include/core/default/Device.h @@ -44,7 +44,10 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::CoreUtils; +using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::ParametersUtil; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::CPP_VERSION; using AudioInputFlags = CoreUtils::AudioInputFlags; using AudioOutputFlags = CoreUtils::AudioOutputFlags; @@ -63,14 +66,32 @@ struct Device : public IDevice, public ParametersUtil { Return getInputBufferSize(const AudioConfig& config, getInputBufferSize_cb _hidl_cb) override; - std::tuple> openOutputStreamImpl(int32_t ioHandle, + std::tuple> openOutputStreamCore(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, const AudioOutputFlags& flags, AudioConfig* suggestedConfig); - std::tuple> openInputStreamImpl( + std::tuple> openInputStreamCore( int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, const AudioInputFlags& flags, AudioSource source, AudioConfig* suggestedConfig); +#if MAJOR_VERSION >= 4 + std::tuple, AudioConfig> openOutputStreamImpl( + int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, + const SourceMetadata& sourceMetadata, +#if MAJOR_VERSION <= 6 + AudioOutputFlags flags); +#else + const AudioOutputFlags& flags); +#endif + std::tuple, AudioConfig> openInputStreamImpl( + int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, +#if MAJOR_VERSION <= 6 + AudioInputFlags flags, +#else + const AudioInputFlags& flags, +#endif + const SinkMetadata& sinkMetadata); +#endif // MAJOR_VERSION >= 4 Return openOutputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, @@ -97,6 +118,17 @@ struct Device : public IDevice, public ParametersUtil { #endif openInputStream_cb _hidl_cb) override; +#if MAJOR_VERSION == 7 && MINOR_VERSION == 1 + Return openOutputStream_7_1(int32_t ioHandle, const DeviceAddress& device, + const AudioConfig& config, const AudioOutputFlags& flags, + const SourceMetadata& sourceMetadata, + openOutputStream_7_1_cb _hidl_cb) override; + Return openInputStream_7_1(int32_t ioHandle, const DeviceAddress& device, + const AudioConfig& config, const AudioInputFlags& flags, + const SinkMetadata& sinkMetadata, + openInputStream_7_1_cb _hidl_cb) override; +#endif + Return supportsAudioPatches() override; Return createAudioPatch(const hidl_vec& sources, const hidl_vec& sinks, diff --git a/audio/core/all-versions/default/include/core/default/DevicesFactory.h b/audio/core/all-versions/default/include/core/default/DevicesFactory.h index 9f93a38a0e..566bc8ad79 100644 --- a/audio/core/all-versions/default/include/core/default/DevicesFactory.h +++ b/audio/core/all-versions/default/include/core/default/DevicesFactory.h @@ -44,11 +44,17 @@ struct DevicesFactory : public IDevicesFactory { Return openDevice(const hidl_string& device, openDevice_cb _hidl_cb) override; Return openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) override; #endif +#if MAJOR_VERSION == 7 && MINOR_VERSION == 1 + Return openDevice_7_1(const hidl_string& device, openDevice_7_1_cb _hidl_cb) override; + Return openPrimaryDevice_7_1(openPrimaryDevice_7_1_cb _hidl_cb) override; +#endif - private: + private: template Return openDevice(const char* moduleName, Callback _hidl_cb); +#if MAJOR_VERSION == 2 Return openDevice(const char* moduleName, openDevice_cb _hidl_cb); +#endif static int loadAudioInterface(const char* if_name, audio_hw_device_t** dev); }; diff --git a/audio/core/all-versions/default/include/core/default/ParametersUtil.h b/audio/core/all-versions/default/include/core/default/ParametersUtil.h index 45d9b2140d..25c193aedd 100644 --- a/audio/core/all-versions/default/include/core/default/ParametersUtil.h +++ b/audio/core/all-versions/default/include/core/default/ParametersUtil.h @@ -17,7 +17,10 @@ #ifndef ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_ #define ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_ -#include PATH(android/hardware/audio/FILE_VERSION/types.h) +// clang-format off +#include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h) +#include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/types.h) +// clang-format on #include #include @@ -28,13 +31,13 @@ namespace android { namespace hardware { namespace audio { -namespace CPP_VERSION { +namespace CORE_TYPES_CPP_VERSION { namespace implementation { using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; -using namespace ::android::hardware::audio::common::CPP_VERSION; -using namespace ::android::hardware::audio::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION; class ParametersUtil { public: @@ -62,7 +65,7 @@ class ParametersUtil { }; } // namespace implementation -} // namespace CPP_VERSION +} // namespace CORE_TYPES_CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/include/core/default/PrimaryDevice.h b/audio/core/all-versions/default/include/core/default/PrimaryDevice.h index 5f65acfcf1..8b37e014b5 100644 --- a/audio/core/all-versions/default/include/core/default/PrimaryDevice.h +++ b/audio/core/all-versions/default/include/core/default/PrimaryDevice.h @@ -36,7 +36,8 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::CPP_VERSION; struct PrimaryDevice : public IPrimaryDevice { @@ -135,8 +136,10 @@ struct PrimaryDevice : public IPrimaryDevice { Return setBtHfpVolume(float volume) override; Return updateRotation(IPrimaryDevice::Rotation rotation) override; #endif - - private: +#if MAJOR_VERSION == 7 && MINOR_VERSION == 1 + Return> getDevice() override { return mDevice; } +#endif + private: sp mDevice; virtual ~PrimaryDevice(); diff --git a/audio/core/all-versions/default/include/core/default/Stream.h b/audio/core/all-versions/default/include/core/default/Stream.h index 66d60e3aa7..4e7988401e 100644 --- a/audio/core/all-versions/default/include/core/default/Stream.h +++ b/audio/core/all-versions/default/include/core/default/Stream.h @@ -17,7 +17,9 @@ #ifndef ANDROID_HARDWARE_AUDIO_STREAM_H #define ANDROID_HARDWARE_AUDIO_STREAM_H -#include PATH(android/hardware/audio/FILE_VERSION/IStream.h) +// clang-format off +#include PATH(android/hardware/audio/COMMON_TYPES_FILE_VERSION/IStream.h) +// clang-format on #include "ParametersUtil.h" @@ -41,10 +43,13 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; +using ::android::hardware::audio::CORE_TYPES_CPP_VERSION::implementation::ParametersUtil; #if MAJOR_VERSION <= 6 -using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation:: + AudioChannelBitfield; #endif -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::CPP_VERSION; struct Stream : public IStream, public ParametersUtil { diff --git a/audio/core/all-versions/default/include/core/default/StreamIn.h b/audio/core/all-versions/default/include/core/default/StreamIn.h index a980f3f999..a6346e5db4 100644 --- a/audio/core/all-versions/default/include/core/default/StreamIn.h +++ b/audio/core/all-versions/default/include/core/default/StreamIn.h @@ -42,7 +42,8 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::CPP_VERSION; struct StreamIn : public IStreamIn { diff --git a/audio/core/all-versions/default/include/core/default/StreamOut.h b/audio/core/all-versions/default/include/core/default/StreamOut.h index 0b07972810..60ad5d5ea1 100644 --- a/audio/core/all-versions/default/include/core/default/StreamOut.h +++ b/audio/core/all-versions/default/include/core/default/StreamOut.h @@ -43,7 +43,8 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::CPP_VERSION; struct StreamOut : public IStreamOut { diff --git a/audio/core/all-versions/default/include/core/default/Util.h b/audio/core/all-versions/default/include/core/default/Util.h index 78ae03eab2..abf531732a 100644 --- a/audio/core/all-versions/default/include/core/default/Util.h +++ b/audio/core/all-versions/default/include/core/default/Util.h @@ -17,7 +17,9 @@ #ifndef ANDROID_HARDWARE_AUDIO_UTIL_H #define ANDROID_HARDWARE_AUDIO_UTIL_H -#include PATH(android/hardware/audio/FILE_VERSION/types.h) +// clang-format off +#include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/types.h) +// clang-format on #include #include @@ -27,19 +29,19 @@ namespace android { namespace hardware { namespace audio { -namespace CPP_VERSION { +namespace CORE_TYPES_CPP_VERSION { namespace implementation { -using namespace ::android::hardware::audio::common::CPP_VERSION; -using namespace ::android::hardware::audio::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION; + +namespace util { /** @return true if gain is between 0 and 1 included. */ constexpr bool isGainNormalized(float gain) { return gain >= 0.0 && gain <= 1.0; } -namespace util { - template inline bool element_in(T e, const std::vector& v) { return std::find(v.begin(), v.end(), e) != v.end(); @@ -72,7 +74,7 @@ static inline Result analyzeStatus(const char* className, const char* funcName, } // namespace util } // namespace implementation -} // namespace CPP_VERSION +} // namespace CORE_TYPES_CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/util/CoreUtils.cpp b/audio/core/all-versions/default/util/CoreUtils.cpp index 773be21962..8e83ea1fbc 100644 --- a/audio/core/all-versions/default/util/CoreUtils.cpp +++ b/audio/core/all-versions/default/util/CoreUtils.cpp @@ -15,24 +15,24 @@ */ #if MAJOR_VERSION >= 7 -#include +#include PATH(APM_XSD_ENUMS_H_FILENAME) #endif #include #include #include "util/CoreUtils.h" -using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils; #if MAJOR_VERSION >= 7 namespace xsd { -using namespace ::android::audio::policy::configuration::V7_0; +using namespace ::android::audio::policy::configuration::CPP_VERSION; } #endif namespace android { namespace hardware { namespace audio { -namespace CPP_VERSION { +namespace CORE_TYPES_CPP_VERSION { namespace implementation { #define CONVERT_CHECKED(expr, result) \ @@ -389,7 +389,7 @@ status_t CoreUtils::sourceMetadataToHalV7(const SourceMetadata& sourceMetadata, #if MAJOR_VERSION >= 7 namespace xsd { -using namespace ::android::audio::policy::configuration::V7_0; +using namespace ::android::audio::policy::configuration::CPP_VERSION; } status_t CoreUtils::audioInputFlagsFromHal(audio_input_flags_t halFlagMask, @@ -470,7 +470,7 @@ status_t CoreUtils::audioOutputFlagsToHal(const AudioOutputFlags& flags, #endif } // namespace implementation -} // namespace CPP_VERSION +} // namespace CORE_TYPES_CPP_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/core/all-versions/default/util/include/util/CoreUtils.h b/audio/core/all-versions/default/util/include/util/CoreUtils.h index 1e5272a479..dc35772882 100644 --- a/audio/core/all-versions/default/util/include/util/CoreUtils.h +++ b/audio/core/all-versions/default/util/include/util/CoreUtils.h @@ -17,7 +17,7 @@ #pragma once // clang-format off -#include PATH(android/hardware/audio/FILE_VERSION/types.h) +#include PATH(android/hardware/audio/CORE_TYPES_FILE_VERSION/types.h) // clang-format off #include @@ -30,13 +30,13 @@ namespace android { namespace hardware { namespace audio { -namespace CPP_VERSION { +namespace CORE_TYPES_CPP_VERSION { namespace implementation { using ::android::hardware::audio::common::utils::EnumBitfield; using ::android::hardware::hidl_vec; -using namespace ::android::hardware::audio::common::CPP_VERSION; -using namespace ::android::hardware::audio::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; +using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION; struct CoreUtils { // Note: the converters for DeviceAddress have to be in CoreUtils for HAL V4 @@ -93,8 +93,8 @@ struct CoreUtils { return NO_ERROR; } #else - using AudioInputFlags = hidl_vec<::android::hardware::audio::CPP_VERSION::AudioInOutFlag>; - using AudioOutputFlags = hidl_vec<::android::hardware::audio::CPP_VERSION::AudioInOutFlag>; + using AudioInputFlags = hidl_vec<::android::hardware::audio::CORE_TYPES_CPP_VERSION::AudioInOutFlag>; + using AudioOutputFlags = hidl_vec<::android::hardware::audio::CORE_TYPES_CPP_VERSION::AudioInOutFlag>; static status_t audioInputFlagsFromHal(audio_input_flags_t halFlagMask, AudioInputFlags* flags); static status_t audioInputFlagsToHal(const AudioInputFlags& flags, audio_input_flags_t* halFlagMask); static status_t audioOutputFlagsFromHal(audio_output_flags_t halFlagMask, AudioOutputFlags* flags); diff --git a/audio/effect/all-versions/default/Effect.cpp b/audio/effect/all-versions/default/Effect.cpp index ccfc6b22c9..49f6bf2ece 100644 --- a/audio/effect/all-versions/default/Effect.cpp +++ b/audio/effect/all-versions/default/Effect.cpp @@ -42,9 +42,10 @@ namespace CPP_VERSION { namespace implementation { #if MAJOR_VERSION <= 6 -using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation:: + AudioChannelBitfield; #endif -using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils; namespace { diff --git a/audio/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h index d5218f7240..f9a6796e8f 100644 --- a/audio/effect/all-versions/default/Effect.h +++ b/audio/effect/all-versions/default/Effect.h @@ -48,9 +48,10 @@ using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; #if MAJOR_VERSION <= 6 -using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioDeviceBitfield; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation:: + AudioDeviceBitfield; #endif -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::effect::CPP_VERSION; struct Effect : public IEffect { diff --git a/audio/effect/all-versions/default/EffectsFactory.cpp b/audio/effect/all-versions/default/EffectsFactory.cpp index eb1cb4971c..e93ad893a8 100644 --- a/audio/effect/all-versions/default/EffectsFactory.cpp +++ b/audio/effect/all-versions/default/EffectsFactory.cpp @@ -53,7 +53,7 @@ namespace effect { namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::CPP_VERSION::implementation::UuidUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::UuidUtils; // static sp EffectsFactory::dispatchEffectInstanceCreation(const effect_descriptor_t& halDescriptor, diff --git a/audio/effect/all-versions/default/EffectsFactory.h b/audio/effect/all-versions/default/EffectsFactory.h index 0b86836e4b..da16923b1e 100644 --- a/audio/effect/all-versions/default/EffectsFactory.h +++ b/audio/effect/all-versions/default/EffectsFactory.h @@ -41,7 +41,7 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::effect::CPP_VERSION; struct EffectsFactory : public IEffectsFactory { diff --git a/audio/effect/all-versions/default/EnvironmentalReverbEffect.h b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h index 9694b5d8c1..001774d7fe 100644 --- a/audio/effect/all-versions/default/EnvironmentalReverbEffect.h +++ b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h @@ -43,7 +43,7 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::effect::CPP_VERSION; struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect { diff --git a/audio/effect/all-versions/default/EqualizerEffect.h b/audio/effect/all-versions/default/EqualizerEffect.h index 7a6bc0a8b0..c4d76c1c18 100644 --- a/audio/effect/all-versions/default/EqualizerEffect.h +++ b/audio/effect/all-versions/default/EqualizerEffect.h @@ -43,7 +43,7 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::effect::CPP_VERSION; struct EqualizerEffect : public IEqualizerEffect { diff --git a/audio/effect/all-versions/default/LoudnessEnhancerEffect.h b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h index 6d80207dc3..122ec364c9 100644 --- a/audio/effect/all-versions/default/LoudnessEnhancerEffect.h +++ b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h @@ -39,7 +39,7 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::effect::CPP_VERSION; struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect { diff --git a/audio/effect/all-versions/default/NoiseSuppressionEffect.h b/audio/effect/all-versions/default/NoiseSuppressionEffect.h index 6cc45b983c..96b9ecfd62 100644 --- a/audio/effect/all-versions/default/NoiseSuppressionEffect.h +++ b/audio/effect/all-versions/default/NoiseSuppressionEffect.h @@ -41,7 +41,7 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::effect::CPP_VERSION; struct NoiseSuppressionEffect : public INoiseSuppressionEffect { diff --git a/audio/effect/all-versions/default/PresetReverbEffect.h b/audio/effect/all-versions/default/PresetReverbEffect.h index eb55e20fe2..9d82c08abd 100644 --- a/audio/effect/all-versions/default/PresetReverbEffect.h +++ b/audio/effect/all-versions/default/PresetReverbEffect.h @@ -39,7 +39,7 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::effect::CPP_VERSION; struct PresetReverbEffect : public IPresetReverbEffect { diff --git a/audio/effect/all-versions/default/VirtualizerEffect.cpp b/audio/effect/all-versions/default/VirtualizerEffect.cpp index 1dce1810ea..6efc4eaa12 100644 --- a/audio/effect/all-versions/default/VirtualizerEffect.cpp +++ b/audio/effect/all-versions/default/VirtualizerEffect.cpp @@ -34,7 +34,7 @@ namespace effect { namespace CPP_VERSION { namespace implementation { -using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils; VirtualizerEffect::VirtualizerEffect(effect_handle_t handle) : mEffect(new Effect(false /*isInput*/, handle)) {} diff --git a/audio/effect/all-versions/default/VirtualizerEffect.h b/audio/effect/all-versions/default/VirtualizerEffect.h index 3ed06d147f..f26e4fa215 100644 --- a/audio/effect/all-versions/default/VirtualizerEffect.h +++ b/audio/effect/all-versions/default/VirtualizerEffect.h @@ -40,9 +40,10 @@ using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; #if MAJOR_VERSION <= 6 -using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation:: + AudioChannelBitfield; #endif -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::effect::CPP_VERSION; struct VirtualizerEffect : public IVirtualizerEffect { diff --git a/audio/effect/all-versions/default/VisualizerEffect.h b/audio/effect/all-versions/default/VisualizerEffect.h index 3ae4b08193..b8424c418d 100644 --- a/audio/effect/all-versions/default/VisualizerEffect.h +++ b/audio/effect/all-versions/default/VisualizerEffect.h @@ -39,7 +39,7 @@ using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; using namespace ::android::hardware::audio::effect::CPP_VERSION; struct VisualizerEffect : public IVisualizerEffect { diff --git a/audio/effect/all-versions/default/util/EffectUtils.cpp b/audio/effect/all-versions/default/util/EffectUtils.cpp index 1156d211a1..296f84d2db 100644 --- a/audio/effect/all-versions/default/util/EffectUtils.cpp +++ b/audio/effect/all-versions/default/util/EffectUtils.cpp @@ -25,8 +25,8 @@ #include "util/EffectUtils.h" -using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils; -using ::android::hardware::audio::common::CPP_VERSION::implementation::UuidUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::HidlUtils; +using ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION::implementation::UuidUtils; using ::android::hardware::audio::common::utils::EnumBitfield; namespace android { @@ -36,7 +36,7 @@ namespace effect { namespace CPP_VERSION { namespace implementation { -using namespace ::android::hardware::audio::common::CPP_VERSION; +using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; #define CONVERT_CHECKED(expr, result) \ if (status_t status = (expr); status != NO_ERROR) { \ diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index f751efc419..b65b159378 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -10,7 +10,7 @@ android.hardware.audio 6.0 - 7.0 + 7.0-1 IDevicesFactory default