Audio HAL V7.1: Update the default implementation am: 8140f5660a
am: 3271045ef3
am: 6627918ad2
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1973701 Change-Id: Id03b8f6ea382f6121ab9c37406089bcedb4529dc
This commit is contained in:
commit
dd8df014a0
38 changed files with 355 additions and 126 deletions
|
@ -21,7 +21,7 @@
|
|||
#define LOG_TAG "HidlUtils"
|
||||
#include <log/log.h>
|
||||
|
||||
#include <android_audio_policy_configuration_V7_0-enums.h>
|
||||
#include PATH(APM_XSD_ENUMS_H_FILENAME)
|
||||
#include <common/all-versions/HidlSupport.h>
|
||||
#include <common/all-versions/VersionUtils.h>
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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 <memory>
|
||||
#include <string>
|
||||
|
@ -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
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <string>
|
||||
|
||||
// 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 <system/audio.h>
|
||||
|
@ -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:
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -66,6 +66,7 @@ int main(int /* argc */, char* /* argv */ []) {
|
|||
const std::vector<InterfacesList> 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",
|
||||
|
|
|
@ -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: <major>.<minor> */
|
||||
#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<major>_<minor> */
|
||||
#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
|
||||
|
|
|
@ -161,3 +161,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"],
|
||||
}
|
||||
|
|
|
@ -41,7 +41,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) {}
|
||||
|
||||
|
@ -84,7 +87,7 @@ Return<Result> 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;
|
||||
}
|
||||
|
@ -150,7 +153,7 @@ Return<void> Device::getInputBufferSize(const AudioConfig& config, getInputBuffe
|
|||
return Void();
|
||||
}
|
||||
|
||||
std::tuple<Result, sp<IStreamOut>> Device::openOutputStreamImpl(int32_t ioHandle,
|
||||
std::tuple<Result, sp<IStreamOut>> Device::openOutputStreamCore(int32_t ioHandle,
|
||||
const DeviceAddress& device,
|
||||
const AudioConfig& config,
|
||||
const AudioOutputFlags& flags,
|
||||
|
@ -187,7 +190,7 @@ std::tuple<Result, sp<IStreamOut>> Device::openOutputStreamImpl(int32_t ioHandle
|
|||
return {analyzeStatus("open_output_stream", status, {EINVAL} /*ignore*/), streamOut};
|
||||
}
|
||||
|
||||
std::tuple<Result, sp<IStreamIn>> Device::openInputStreamImpl(
|
||||
std::tuple<Result, sp<IStreamIn>> Device::openInputStreamCore(
|
||||
int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config,
|
||||
const AudioInputFlags& flags, AudioSource source, AudioConfig* suggestedConfig) {
|
||||
audio_config_t halConfig;
|
||||
|
@ -230,7 +233,7 @@ Return<void> 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();
|
||||
}
|
||||
|
@ -240,12 +243,36 @@ Return<void> 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<Result, sp<IStreamOut>, 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<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config,
|
||||
#if MAJOR_VERSION <= 6
|
||||
|
@ -255,27 +282,46 @@ Return<void> 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<Result, sp<IStreamIn>, 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<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config,
|
||||
#if MAJOR_VERSION <= 6
|
||||
|
@ -285,36 +331,35 @@ Return<void> 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<void> 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<void> 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<bool> Device::supportsAudioPatches() {
|
||||
return version() >= AUDIO_DEVICE_API_VERSION_3_0;
|
||||
}
|
||||
|
|
|
@ -47,22 +47,54 @@ Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevi
|
|||
_hidl_cb(Result::INVALID_ARGUMENTS, nullptr);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> DevicesFactory::openDevice(const char* moduleName, openDevice_cb _hidl_cb) {
|
||||
return openDevice<implementation::Device>(moduleName, _hidl_cb);
|
||||
}
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> DevicesFactory::openDevice(const hidl_string& moduleName, openDevice_cb _hidl_cb) {
|
||||
if (moduleName == AUDIO_HARDWARE_MODULE_ID_PRIMARY) {
|
||||
return openDevice<PrimaryDevice>(moduleName.c_str(), _hidl_cb);
|
||||
}
|
||||
return openDevice(moduleName.c_str(), _hidl_cb);
|
||||
return openDevice<implementation::Device>(moduleName.c_str(), _hidl_cb);
|
||||
}
|
||||
Return<void> DevicesFactory::openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) {
|
||||
return openDevice<PrimaryDevice>(AUDIO_HARDWARE_MODULE_ID_PRIMARY, _hidl_cb);
|
||||
}
|
||||
#endif
|
||||
|
||||
Return<void> DevicesFactory::openDevice(const char* moduleName, openDevice_cb _hidl_cb) {
|
||||
return openDevice<implementation::Device>(moduleName, _hidl_cb);
|
||||
#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
|
||||
Return<void> DevicesFactory::openDevice_7_1(const hidl_string& moduleName,
|
||||
openDevice_7_1_cb _hidl_cb) {
|
||||
if (moduleName == AUDIO_HARDWARE_MODULE_ID_PRIMARY) {
|
||||
Result result;
|
||||
sp<IPrimaryDevice> primary;
|
||||
auto ret = openDevice<PrimaryDevice>(
|
||||
AUDIO_HARDWARE_MODULE_ID_PRIMARY,
|
||||
[&result, &primary](Result r, const sp<IPrimaryDevice>& 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<implementation::Device>(moduleName.c_str(), _hidl_cb);
|
||||
}
|
||||
|
||||
Return<void> DevicesFactory::openPrimaryDevice_7_1(openPrimaryDevice_7_1_cb _hidl_cb) {
|
||||
return openDevice<PrimaryDevice>(AUDIO_HARDWARE_MODULE_ID_PRIMARY, _hidl_cb);
|
||||
}
|
||||
#endif // V7.1
|
||||
|
||||
template <class DeviceShim, class Callback>
|
||||
Return<void> DevicesFactory::openDevice(const char* moduleName, Callback _hidl_cb) {
|
||||
audio_hw_device_t* halDevice;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<void> PrimaryDevice::updateAudioPatch(int32_t previousPatch,
|
|||
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IPrimaryDevice follow.
|
||||
Return<Result> 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<Result> PrimaryDevice::setBtHfpSampleRate(uint32_t sampleRateHz) {
|
|||
return mDevice->setParam(AUDIO_PARAMETER_KEY_HFP_SET_SAMPLING_RATE, int(sampleRateHz));
|
||||
}
|
||||
Return<Result> 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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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<void> StreamIn::getAudioSource(getAudioSource_cb _hidl_cb) {
|
|||
}
|
||||
|
||||
Return<Result> 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;
|
||||
}
|
||||
|
|
|
@ -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<Result> 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;
|
||||
}
|
||||
|
|
|
@ -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<void> getInputBufferSize(const AudioConfig& config,
|
||||
getInputBufferSize_cb _hidl_cb) override;
|
||||
|
||||
std::tuple<Result, sp<IStreamOut>> openOutputStreamImpl(int32_t ioHandle,
|
||||
std::tuple<Result, sp<IStreamOut>> openOutputStreamCore(int32_t ioHandle,
|
||||
const DeviceAddress& device,
|
||||
const AudioConfig& config,
|
||||
const AudioOutputFlags& flags,
|
||||
AudioConfig* suggestedConfig);
|
||||
std::tuple<Result, sp<IStreamIn>> openInputStreamImpl(
|
||||
std::tuple<Result, sp<IStreamIn>> openInputStreamCore(
|
||||
int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config,
|
||||
const AudioInputFlags& flags, AudioSource source, AudioConfig* suggestedConfig);
|
||||
#if MAJOR_VERSION >= 4
|
||||
std::tuple<Result, sp<IStreamOut>, 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<Result, sp<IStreamIn>, 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<void> 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<void> 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<void> 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<bool> supportsAudioPatches() override;
|
||||
Return<void> createAudioPatch(const hidl_vec<AudioPortConfig>& sources,
|
||||
const hidl_vec<AudioPortConfig>& sinks,
|
||||
|
|
|
@ -44,11 +44,17 @@ struct DevicesFactory : public IDevicesFactory {
|
|||
Return<void> openDevice(const hidl_string& device, openDevice_cb _hidl_cb) override;
|
||||
Return<void> openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) override;
|
||||
#endif
|
||||
#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
|
||||
Return<void> openDevice_7_1(const hidl_string& device, openDevice_7_1_cb _hidl_cb) override;
|
||||
Return<void> openPrimaryDevice_7_1(openPrimaryDevice_7_1_cb _hidl_cb) override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
private:
|
||||
template <class DeviceShim, class Callback>
|
||||
Return<void> openDevice(const char* moduleName, Callback _hidl_cb);
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> openDevice(const char* moduleName, openDevice_cb _hidl_cb);
|
||||
#endif
|
||||
|
||||
static int loadAudioInterface(const char* if_name, audio_hw_device_t** dev);
|
||||
};
|
||||
|
|
|
@ -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 <functional>
|
||||
#include <memory>
|
||||
|
@ -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
|
||||
|
|
|
@ -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<Result> setBtHfpVolume(float volume) override;
|
||||
Return<Result> updateRotation(IPrimaryDevice::Rotation rotation) override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
#if MAJOR_VERSION == 7 && MINOR_VERSION == 1
|
||||
Return<sp<::android::hardware::audio::V7_1::IDevice>> getDevice() override { return mDevice; }
|
||||
#endif
|
||||
private:
|
||||
sp<Device> mDevice;
|
||||
|
||||
virtual ~PrimaryDevice();
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 <algorithm>
|
||||
#include <vector>
|
||||
|
@ -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 <typename T>
|
||||
inline bool element_in(T e, const std::vector<T>& 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
|
||||
|
|
|
@ -15,24 +15,24 @@
|
|||
*/
|
||||
|
||||
#if MAJOR_VERSION >= 7
|
||||
#include <android_audio_policy_configuration_V7_0-enums.h>
|
||||
#include PATH(APM_XSD_ENUMS_H_FILENAME)
|
||||
#endif
|
||||
#include <HidlUtils.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#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
|
||||
|
|
|
@ -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 <vector>
|
||||
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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<IEffect> EffectsFactory::dispatchEffectInstanceCreation(const effect_descriptor_t& halDescriptor,
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)) {}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) { \
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<hal format="hidl" optional="false">
|
||||
<name>android.hardware.audio</name>
|
||||
<version>6.0</version>
|
||||
<version>7.0</version>
|
||||
<version>7.0-1</version>
|
||||
<interface>
|
||||
<name>IDevicesFactory</name>
|
||||
<instance>default</instance>
|
||||
|
|
Loading…
Reference in a new issue