Merge changes from topic "audio-hal-v4-pi-dev" into pi-dev

* changes:
  Audio V4: Declare support for 4.0 interface
  Audio V4: Implement the shim core 4.0 -> legacy
  Audio V4: Add its own function to open the primary device
  Audio V4: Move service entry point to common
  Audio V4: Implement the shim effect 4.0 -> legacy
  Audio V4: Update .hal doc to removal of audioSource
  Audio V4: Use string to identify audio Device
  Fix potential missing '\0' when wrapping to legacy
  Audio V4: Cast conversion now deduce both types
  Audio V4: Add V4 common utils
  Audio V4: Do not forward notification detail
  Audio V4: Remove system only enum values
This commit is contained in:
TreeHugger Robot
2018-03-07 03:23:51 +00:00
committed by Android (Google) Code Review
105 changed files with 2357 additions and 307 deletions

View File

@@ -132,7 +132,6 @@ interface IDevice {
* @param device device type and (if needed) address.
* @param config stream configuration.
* @param flags additional flags.
* @param source source specification.
* @param sinkMetadata Description of the audio that is suggested by the client.
* May be used by implementations to configure hardware effects.
* @return retval operation completion status.

View File

@@ -18,42 +18,53 @@ package android.hardware.audio@4.0;
import android.hardware.audio.common@4.0;
import IDevice;
import IPrimaryDevice;
/** This factory allows a HAL implementation to be split in multiple independent
* devices (called module in the pre-treble API).
* Note that this division is arbitrary and implementation are free
* to only have a Primary.
* The framework will query the devices according to audio_policy_configuration.xml
*
* Each device name is arbitrary, provided by the vendor's audio_policy_configuration.xml
* and only used to identify a device in this factory.
* The framework must not interpret the name, treating it as a vendor opaque data
* with the following exception:
* - the "r_submix" device that must be present to support policyMixes (Eg: Android projected).
* Note that this Device is included by default in a build derived from AOSP.
*
* Note that on AOSP Oreo (including MR1) the "a2dp" module is not using this API
* but is loaded directly from the system partition using the legacy API
* due to limitations with the Bluetooth framework.
*/
interface IDevicesFactory {
/** Allows a HAL implementation to be split in multiple independent
* devices (called module in the pre-treble API).
* Note that this division is arbitrary and implementation are free
* to only have a Primary.
* The framework will query the devices according to audio_policy_configuration.xml
*
* Each Device value is interchangeable with any other and the framework
* does not differentiate between values with the following exceptions:
* - the Primary device must always be present
* - the R_SUBMIX that is used to forward audio of REMOTE_SUBMIX DEVICES
*/
enum Device : int32_t {
PRIMARY,
A2DP,
USB,
R_SUBMIX,
STUB,
CODEC_OFFLOAD,
SECONDARY,
AUXILIARY,
/** Multi Stream Decoder */
MSD
};
/**
* Opens an audio device. To close the device, it is necessary to release
* references to the returned device object.
*
* @param device device type.
* @param device device name.
* @return retval operation completion status. Returns INVALID_ARGUMENTS
* if there is no corresponding hardware module found,
* NOT_INITIALIZED if an error occured while opening the hardware
* module.
* @return result the interface for the created device.
*/
openDevice(Device device) generates (Result retval, IDevice result);
openDevice(string device) generates (Result retval, IDevice result);
/**
* Opens the Primary audio device that must be present.
* This function is not optional and must return successfully the primary device.
*
* This device must have the name "primary".
*
* The telephony stack uses this device to control the audio during a voice call.
*
* @return retval operation completion status. Must be SUCCESS.
* For debuging, return INVALID_ARGUMENTS if there is no corresponding
* hardware module found, NOT_INITIALIZED if an error occurred
* while opening the hardware module.
* @return result the interface for the created device.
*/
openPrimaryDevice() generates (Result retval, IPrimaryDevice result);
};

View File

@@ -66,35 +66,6 @@
<xs:complexType name="globalConfiguration">
<xs:attribute name="speaker_drc_enabled" type="xs:boolean" use="required"/>
</xs:complexType>
<!-- Enum values of IDevicesFactory::Device
TODO: generate from hidl to avoid manual sync. -->
<xs:simpleType name="halName">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="primary"/>
<xs:enumeration value="a2dp"/>
<xs:enumeration value="usb"/>
<xs:enumeration value="r_submix"/>
<xs:enumeration value="codec_offload"/>
<xs:enumeration value="stub"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:annotation>
<xs:documentation xml:lang="en">
Vendor eXtension names must be in the vx namespace.
Vendor are encouraged to namespace their module names.
Example for an hypothetical Google virtual reality HAL:
<module name="vx_google_vr" halVersion="3.0"/>
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="vx_[_a-zA-Z0-9]+"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:complexType name="modules">
<xs:annotation>
<xs:documentation xml:lang="en">
@@ -133,7 +104,7 @@
<xs:element name="devicePorts" type="devicePorts" minOccurs="0"/>
<xs:element name="routes" type="routes" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="halName" use="required"/>
<xs:attribute name="name" type="xsd:string" use="required"/>
<xs:attribute name="halVersion" type="halVersion" use="required"/>
</xs:complexType>
<xs:unique name="mixPortNameUniqueness">

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
#include <android/hardware/audio/common/2.0/types.h>
namespace android {
namespace hardware {
namespace audio {
namespace common {
namespace V2_0 {
namespace implementation {
typedef common::V2_0::AudioDevice AudioDeviceBitfield;
typedef common::V2_0::AudioChannelMask AudioChannelBitfield;
typedef common::V2_0::AudioOutputFlag AudioOutputFlagBitfield;
typedef common::V2_0::AudioInputFlag AudioInputFlagBitfield;
} // namespace implementation
} // namespace V2_0
} // namespace common
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H

View File

@@ -0,0 +1,47 @@
//
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
cc_library_shared {
name: "android.hardware.audio.common@4.0-util",
defaults: ["hidl_defaults"],
vendor_available: true,
vndk: {
enabled: true,
},
srcs: [
"HidlUtils.cpp",
],
export_include_dirs: ["."],
static_libs: [
],
shared_libs: [
"liblog",
"libutils",
"libhidlbase",
"android.hardware.audio.common-util",
"android.hardware.audio.common@4.0",
],
export_shared_lib_headers: [
"android.hardware.audio.common-util"
],
header_libs: [
"libaudio_system_headers",
"libhardware_headers",
],
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "HidlUtils.h"
#define AUDIO_HAL_VERSION V4_0
#include <common/all-versions/default/HidlUtils.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef android_hardware_audio_V4_0_Hidl_Utils_H_
#define android_hardware_audio_V4_0_Hidl_Utils_H_
#include <android/hardware/audio/common/4.0/types.h>
#define AUDIO_HAL_VERSION V4_0
#include <common/all-versions/default/HidlUtils.h>
#undef AUDIO_HAL_VERSION
#endif // android_hardware_audio_V4_0_Hidl_Utils_H_

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
#include <android/hardware/audio/common/4.0/types.h>
namespace android {
namespace hardware {
namespace audio {
namespace common {
namespace V4_0 {
namespace implementation {
typedef hidl_bitfield<common::V4_0::AudioDevice> AudioDeviceBitfield;
typedef hidl_bitfield<common::V4_0::AudioChannelMask> AudioChannelBitfield;
typedef hidl_bitfield<common::V4_0::AudioOutputFlag> AudioOutputFlagBitfield;
typedef hidl_bitfield<common::V4_0::AudioInputFlag> AudioInputFlagBitfield;
} // namespace implementation
} // namespace V4_0
} // namespace common
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H

View File

@@ -104,8 +104,6 @@ enum AudioStreamType : int32_t {
TTS = 9, // Transmitted Through Speaker. Plays over speaker
// only, silent on other devices
ACCESSIBILITY = 10, // For accessibility talk back prompts
REROUTING = 11, // For dynamic policy output mixes
PATCH = 12, // For internal audio flinger tracks. Fixed volume
};
@export(name="audio_source_t", value_prefix="AUDIO_SOURCE_")
@@ -657,6 +655,8 @@ enum AudioUsage : int32_t {
/** Type of audio generated by an application. */
@export(name="audio_content_type_t", value_prefix="AUDIO_CONTENT_TYPE_")
enum AudioContentType : uint32_t {
// Do not change these values without updating their counterparts
// in frameworks/base/media/java/android/media/AudioAttributes.java
UNKNOWN = 0,
SPEECH = 1,
MUSIC = 2,

View File

@@ -33,7 +33,11 @@ cc_library_shared {
],
header_libs: [
"android.hardware.audio.common.util@all-versions",
"libaudio_system_headers",
"libhardware_headers",
],
export_header_lib_headers: [
"android.hardware.audio.common.util@all-versions",
]
}

View File

@@ -47,6 +47,8 @@ class HidlUtils {
struct audio_gain_config* halConfig);
static void audioGainFromHal(const struct audio_gain& halGain, AudioGain* gain);
static void audioGainToHal(const AudioGain& gain, struct audio_gain* halGain);
static AudioUsage audioUsageFromHal(const audio_usage_t halUsage);
static audio_usage_t audioUsageToHal(const AudioUsage usage);
static void audioOffloadInfoFromHal(const audio_offload_info_t& halOffload,
AudioOffloadInfo* offload);
static void audioOffloadInfoToHal(const AudioOffloadInfo& offload,

View File

@@ -18,6 +18,7 @@
#error "AUDIO_HAL_VERSION must be set before including this file."
#endif
#include <common/all-versions/VersionUtils.h>
#include <string.h>
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
@@ -32,6 +33,8 @@ using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioStreamType;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioUsage;
using ::android::hardware::audio::common::utils::mkEnumConverter;
namespace android {
namespace hardware {
namespace audio {
@@ -40,7 +43,7 @@ namespace AUDIO_HAL_VERSION {
void HidlUtils::audioConfigFromHal(const audio_config_t& halConfig, AudioConfig* config) {
config->sampleRateHz = halConfig.sample_rate;
config->channelMask = AudioChannelMask(halConfig.channel_mask);
config->channelMask = mkEnumConverter<AudioChannelMask>(halConfig.channel_mask);
config->format = AudioFormat(halConfig.format);
audioOffloadInfoFromHal(halConfig.offload_info, &config->offloadInfo);
config->frameCount = halConfig.frame_count;
@@ -58,8 +61,8 @@ void HidlUtils::audioConfigToHal(const AudioConfig& config, audio_config_t* halC
void HidlUtils::audioGainConfigFromHal(const struct audio_gain_config& halConfig,
AudioGainConfig* config) {
config->index = halConfig.index;
config->mode = AudioGainMode(halConfig.mode);
config->channelMask = AudioChannelMask(halConfig.channel_mask);
config->mode = mkEnumConverter<AudioGainMode>(halConfig.mode);
config->channelMask = mkEnumConverter<AudioChannelMask>(halConfig.channel_mask);
for (size_t i = 0; i < sizeof(audio_channel_mask_t) * 8; ++i) {
config->values[i] = halConfig.values[i];
}
@@ -79,8 +82,8 @@ void HidlUtils::audioGainConfigToHal(const AudioGainConfig& config,
}
void HidlUtils::audioGainFromHal(const struct audio_gain& halGain, AudioGain* gain) {
gain->mode = AudioGainMode(halGain.mode);
gain->channelMask = AudioChannelMask(halGain.channel_mask);
gain->mode = mkEnumConverter<AudioGainMode>(halGain.mode);
gain->channelMask = mkEnumConverter<AudioChannelMask>(halGain.channel_mask);
gain->minValue = halGain.min_value;
gain->maxValue = halGain.max_value;
gain->defaultValue = halGain.default_value;
@@ -100,10 +103,26 @@ void HidlUtils::audioGainToHal(const AudioGain& gain, struct audio_gain* halGain
halGain->max_ramp_ms = gain.maxRampMs;
}
AudioUsage HidlUtils::audioUsageFromHal(const audio_usage_t halUsage) {
switch (halUsage) {
case AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST:
case AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT:
case AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED:
case AUDIO_USAGE_NOTIFICATION_EVENT:
return AudioUsage::NOTIFICATION;
default:
return static_cast<AudioUsage>(halUsage);
}
}
audio_usage_t HidlUtils::audioUsageToHal(const AudioUsage usage) {
return static_cast<audio_usage_t>(usage);
}
void HidlUtils::audioOffloadInfoFromHal(const audio_offload_info_t& halOffload,
AudioOffloadInfo* offload) {
offload->sampleRateHz = halOffload.sample_rate;
offload->channelMask = AudioChannelMask(halOffload.channel_mask);
offload->channelMask = mkEnumConverter<AudioChannelMask>(halOffload.channel_mask);
offload->format = AudioFormat(halOffload.format);
offload->streamType = AudioStreamType(halOffload.stream_type);
offload->bitRatePerSecond = halOffload.bit_rate;
@@ -112,7 +131,7 @@ void HidlUtils::audioOffloadInfoFromHal(const audio_offload_info_t& halOffload,
offload->isStreaming = halOffload.is_streaming;
offload->bitWidth = halOffload.bit_width;
offload->bufferSize = halOffload.offload_buffer_size;
offload->usage = static_cast<AudioUsage>(halOffload.usage);
offload->usage = audioUsageFromHal(halOffload.usage);
}
void HidlUtils::audioOffloadInfoToHal(const AudioOffloadInfo& offload,
@@ -128,7 +147,7 @@ void HidlUtils::audioOffloadInfoToHal(const AudioOffloadInfo& offload,
halOffload->is_streaming = offload.isStreaming;
halOffload->bit_width = offload.bitWidth;
halOffload->offload_buffer_size = offload.bufferSize;
halOffload->usage = static_cast<audio_usage_t>(offload.usage);
halOffload->usage = audioUsageToHal(offload.usage);
}
void HidlUtils::audioPortConfigFromHal(const struct audio_port_config& halConfig,
@@ -136,9 +155,9 @@ void HidlUtils::audioPortConfigFromHal(const struct audio_port_config& halConfig
config->id = halConfig.id;
config->role = AudioPortRole(halConfig.role);
config->type = AudioPortType(halConfig.type);
config->configMask = AudioPortConfigMask(halConfig.config_mask);
config->configMask = mkEnumConverter<AudioPortConfigMask>(halConfig.config_mask);
config->sampleRateHz = halConfig.sample_rate;
config->channelMask = AudioChannelMask(halConfig.channel_mask);
config->channelMask = mkEnumConverter<AudioChannelMask>(halConfig.channel_mask);
config->format = AudioFormat(halConfig.format);
audioGainConfigFromHal(halConfig.gain, &config->gain);
switch (halConfig.type) {
@@ -238,7 +257,7 @@ void HidlUtils::audioPortFromHal(const struct audio_port& halPort, AudioPort* po
}
port->channelMasks.resize(halPort.num_channel_masks);
for (size_t i = 0; i < halPort.num_channel_masks; ++i) {
port->channelMasks[i] = AudioChannelMask(halPort.channel_masks[i]);
port->channelMasks[i] = mkEnumConverter<AudioChannelMask>(halPort.channel_masks[i]);
}
port->formats.resize(halPort.num_formats);
for (size_t i = 0; i < halPort.num_formats; ++i) {
@@ -277,8 +296,8 @@ void HidlUtils::audioPortToHal(const AudioPort& port, struct audio_port* halPort
halPort->id = port.id;
halPort->role = static_cast<audio_port_role_t>(port.role);
halPort->type = static_cast<audio_port_type_t>(port.type);
memcpy(halPort->name, port.name.c_str(),
std::min(port.name.size(), static_cast<size_t>(AUDIO_PORT_MAX_NAME_LEN)));
strncpy(halPort->name, port.name.c_str(), AUDIO_PORT_MAX_NAME_LEN);
halPort->name[AUDIO_PORT_MAX_NAME_LEN - 1] = '\0';
halPort->num_sample_rates =
std::min(port.sampleRates.size(), static_cast<size_t>(AUDIO_PORT_MAX_SAMPLING_RATES));
for (size_t i = 0; i < halPort->num_sample_rates; ++i) {

View File

@@ -38,8 +38,11 @@ LOCAL_SHARED_LIBRARIES := \
libutils \
libhardware \
android.hardware.audio@2.0 \
android.hardware.audio@4.0 \
android.hardware.audio.common@2.0 \
android.hardware.audio.common@4.0 \
android.hardware.audio.effect@2.0 \
android.hardware.audio.effect@4.0 \
android.hardware.soundtrigger@2.0 \
android.hardware.soundtrigger@2.1

View File

@@ -17,23 +17,16 @@
#define LOG_TAG "audiohalservice"
#include <android/hardware/audio/2.0/IDevicesFactory.h>
#include <android/hardware/audio/4.0/IDevicesFactory.h>
#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
#include <android/hardware/audio/effect/4.0/IEffectsFactory.h>
#include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
#include <android/hardware/soundtrigger/2.1/ISoundTriggerHw.h>
#include <binder/ProcessState.h>
#include <hidl/HidlTransportSupport.h>
#include <hidl/LegacySupport.h>
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::hardware::registerPassthroughServiceImplementation;
using android::hardware::audio::effect::V2_0::IEffectsFactory;
using android::hardware::audio::V2_0::IDevicesFactory;
using V2_0_ISoundTriggerHw = android::hardware::soundtrigger::V2_0::ISoundTriggerHw;
using V2_1_ISoundTriggerHw = android::hardware::soundtrigger::V2_1::ISoundTriggerHw;
using android::hardware::registerPassthroughServiceImplementation;
using namespace android::hardware;
using android::OK;
int main(int /* argc */, char* /* argv */ []) {
@@ -41,16 +34,18 @@ int main(int /* argc */, char* /* argv */ []) {
// start a threadpool for vndbinder interactions
android::ProcessState::self()->startThreadPool();
configureRpcThreadpool(16, true /*callerWillJoin*/);
android::status_t status;
status = registerPassthroughServiceImplementation<IDevicesFactory>();
LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio service: %d", status);
status = registerPassthroughServiceImplementation<IEffectsFactory>();
LOG_ALWAYS_FATAL_IF(status != OK, "Error while registering audio effects service: %d", status);
// Soundtrigger might be not present.
status = registerPassthroughServiceImplementation<V2_1_ISoundTriggerHw>();
ALOGW_IF(status != OK, "Registering soundtrigger V2.1 service was unsuccessful: %d", status);
status = registerPassthroughServiceImplementation<V2_0_ISoundTriggerHw>();
ALOGW_IF(status != OK, "Registering soundtrigger V2.0 service was unsuccessful: %d", status);
bool fail = registerPassthroughServiceImplementation<audio::V4_0::IDevicesFactory>() != OK &&
registerPassthroughServiceImplementation<audio::V2_0::IDevicesFactory>() != OK;
LOG_ALWAYS_FATAL_IF(fail, "Could not register audio core API 2.0 nor 4.0");
fail = registerPassthroughServiceImplementation<audio::effect::V4_0::IEffectsFactory>() != OK &&
registerPassthroughServiceImplementation<audio::effect::V2_0::IEffectsFactory>() != OK,
LOG_ALWAYS_FATAL_IF(fail, "Could not register audio effect API 2.0 nor 4.0");
fail = registerPassthroughServiceImplementation<soundtrigger::V2_1::ISoundTriggerHw>() != OK &&
registerPassthroughServiceImplementation<soundtrigger::V2_0::ISoundTriggerHw>() != OK,
ALOGW_IF(fail, "Could not register soundtrigger API 2.0 nor 2.1");
joinRpcThreadpool();
return status;
}

View File

@@ -0,0 +1,61 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef android_hardware_audio_common_VersionUtils_H_
#define android_hardware_audio_common_VersionUtils_H_
#include <hidl/HidlSupport.h>
#include <type_traits>
namespace android {
namespace hardware {
namespace audio {
namespace common {
namespace utils {
/** Similar to static_cast but also casts to hidl_bitfield depending on
* return type inference (emulated through user-define conversion).
*/
template <class Source, class Destination = Source>
class EnumConverter {
public:
static_assert(std::is_enum<Source>::value || std::is_enum<Destination>::value,
"Source or destination should be an enum");
explicit EnumConverter(Source source) : mSource(source) {}
operator Destination() const { return static_cast<Destination>(mSource); }
template <class = std::enable_if_t<std::is_enum<Destination>::value>>
operator ::android::hardware::hidl_bitfield<Destination>() {
return static_cast<std::underlying_type_t<Destination>>(mSource);
}
private:
const Source mSource;
};
template <class Destination, class Source>
auto mkEnumConverter(Source source) {
return EnumConverter<Source, Destination>{source};
}
} // namespace utils
} // namespace common
} // namespace audio
} // namespace hardware
} // namespace android
#endif // android_hardware_audio_common_VersionUtils_H_

View File

@@ -14,6 +14,10 @@ cc_library_shared {
"StreamOut.cpp",
],
cflags: [
"-DAUDIO_HAL_VERSION_2_0",
],
defaults: ["hidl_defaults"],
export_include_dirs: ["include"],

View File

@@ -0,0 +1,53 @@
cc_library_shared {
name: "android.hardware.audio@4.0-impl",
relative_install_path: "hw",
proprietary: true,
vendor: true,
srcs: [
"Conversions.cpp",
"Device.cpp",
"DevicesFactory.cpp",
"ParametersUtil.cpp",
"PrimaryDevice.cpp",
"Stream.cpp",
"StreamIn.cpp",
"StreamOut.cpp",
],
cflags: [
"-DAUDIO_HAL_VERSION_4_0",
],
defaults: ["hidl_defaults"],
export_include_dirs: ["include"],
shared_libs: [
"libbase",
"libcutils",
"libfmq",
"libhardware",
"libhidlbase",
"libhidltransport",
"liblog",
"libutils",
"android.hardware.audio@4.0",
"android.hardware.audio.common@4.0",
"android.hardware.audio.common@4.0-util",
"android.hardware.audio.common-util",
],
header_libs: [
"android.hardware.audio.common.util@all-versions",
"android.hardware.audio.core@all-versions-impl",
"libaudioclient_headers",
"libaudio_system_headers",
"libhardware_headers",
"libmedia_headers",
],
whole_static_libs: [
"libmedia_helper",
],
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "core/4.0/default/Conversions.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/Conversions.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "DeviceHAL"
#include "core/4.0/default/Device.h"
#include <HidlUtils.h>
#include "core/4.0/default/Conversions.h"
#include "core/4.0/default/StreamIn.h"
#include "core/4.0/default/StreamOut.h"
#include "core/all-versions/default/Util.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/Device.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "DevicesFactoryHAL"
#include "core/4.0/default/DevicesFactory.h"
#include "core/4.0/default/Device.h"
#include "core/4.0/default/PrimaryDevice.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/DevicesFactory.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "core/4.0/default/ParametersUtil.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/ParametersUtil.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "PrimaryDeviceHAL"
#include "core/4.0/default/PrimaryDevice.h"
#include "core/all-versions/default/Util.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/PrimaryDevice.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "StreamHAL"
#include "core/4.0/default/Stream.h"
#include "common/all-versions/default/EffectMap.h"
#include "core/4.0/default/Conversions.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/Stream.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "StreamInHAL"
#include "core/4.0/default/StreamIn.h"
#include "core/all-versions/default/Util.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/StreamIn.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "StreamOutHAL"
#include "core/4.0/default/StreamOut.h"
#include "core/all-versions/default/Util.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/StreamOut.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_
#define ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_
#include <android/hardware/audio/4.0/types.h>
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/Conversions.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H
#define ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H
#include <android/hardware/audio/4.0/IDevice.h>
#include "ParametersUtil.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/Device.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H
#define ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H
#include <android/hardware/audio/4.0/IDevicesFactory.h>
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/DevicesFactory.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_
#define ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_
#include <android/hardware/audio/4.0/types.h>
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/ParametersUtil.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H
#define ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H
#include <android/hardware/audio/4.0/IPrimaryDevice.h>
#include "Device.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/PrimaryDevice.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H
#define ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H
#include <android/hardware/audio/4.0/IStream.h>
#include "ParametersUtil.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/Stream.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H
#define ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H
#include <android/hardware/audio/4.0/IStreamIn.h>
#include "Device.h"
#include "Stream.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/StreamIn.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H
#define ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H
#include <android/hardware/audio/4.0/IStreamOut.h>
#include "Device.h"
#include "Stream.h"
#define AUDIO_HAL_VERSION V4_0
#include <core/all-versions/default/StreamOut.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H

View File

@@ -1,7 +1,6 @@
cc_library_headers {
name: "android.hardware.audio.core@all-versions-impl",
relative_install_path: "hw",
proprietary: true,
vendor: true,
defaults: ["hidl_defaults"],

View File

@@ -25,6 +25,8 @@
#include <hidl/MQDescriptor.h>
#include <VersionUtils.h>
namespace android {
namespace hardware {
namespace audio {
@@ -39,6 +41,9 @@ using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPatchHandle;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioInputFlagBitfield;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::
AudioOutputFlagBitfield;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
@@ -51,6 +56,11 @@ using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
#ifdef AUDIO_HAL_VERSION_4_0
using ::android::hardware::audio::AUDIO_HAL_VERSION::SourceMetadata;
using ::android::hardware::audio::AUDIO_HAL_VERSION::SinkMetadata;
#endif
struct Device : public IDevice, public ParametersUtil {
explicit Device(audio_hw_device_t* device);
@@ -64,12 +74,26 @@ struct Device : public IDevice, public ParametersUtil {
Return<void> getMasterMute(getMasterMute_cb _hidl_cb) override;
Return<void> getInputBufferSize(const AudioConfig& config,
getInputBufferSize_cb _hidl_cb) override;
// V2 openInputStream is called by V4 input stream thus present in both versions
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlagBitfield flags,
AudioSource source, openInputStream_cb _hidl_cb);
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioOutputFlag flags,
const AudioConfig& config, AudioOutputFlagBitfield flags,
openOutputStream_cb _hidl_cb) override;
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioOutputFlagBitfield flags,
const SourceMetadata& sourceMetadata,
openOutputStream_cb _hidl_cb) override;
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlag flags,
AudioSource source, openInputStream_cb _hidl_cb) override;
const AudioConfig& config, AudioInputFlagBitfield flags,
const SinkMetadata& sinkMetadata,
openInputStream_cb _hidl_cb) override;
#endif
Return<bool> supportsAudioPatches() override;
Return<void> createAudioPatch(const hidl_vec<AudioPortConfig>& sources,
const hidl_vec<AudioPortConfig>& sinks,
@@ -77,12 +101,27 @@ struct Device : public IDevice, public ParametersUtil {
Return<Result> releaseAudioPatch(int32_t patch) override;
Return<void> getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) override;
Return<Result> setAudioPortConfig(const AudioPortConfig& config) override;
Return<AudioHwSync> getHwAvSync() override;
Return<Result> setScreenState(bool turnedOn) override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<AudioHwSync> getHwAvSync() override;
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
Return<void> debugDump(const hidl_handle& fd) override;
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> getHwAvSync(getHwAvSync_cb _hidl_cb) override;
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) override;
Return<void> getMicrophones(getMicrophones_cb _hidl_cb) override;
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
#endif
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
// Utility methods for extending interfaces.
Result analyzeStatus(const char* funcName, int status);

View File

@@ -147,7 +147,10 @@ Return<void> Device::getInputBufferSize(const AudioConfig& config, getInputBuffe
}
Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioOutputFlag flags,
const AudioConfig& config, AudioOutputFlagBitfield flags,
#ifdef AUDIO_HAL_VERSION_4_0
const SourceMetadata& /* sourceMetadata */,
#endif
openOutputStream_cb _hidl_cb) {
audio_config_t halConfig;
HidlUtils::audioConfigToHal(config, &halConfig);
@@ -174,7 +177,7 @@ Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& dev
}
Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlag flags,
const AudioConfig& config, AudioInputFlagBitfield flags,
AudioSource source, openInputStream_cb _hidl_cb) {
audio_config_t halConfig;
HidlUtils::audioConfigToHal(config, &halConfig);
@@ -201,6 +204,24 @@ Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& devi
return Void();
}
#ifdef AUDIO_HAL_VERSION_4_0
Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlagBitfield flags,
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();
}
// Pick the first one as the main until the legacy API is update
AudioSource source = sinkMetadata.tracks[0].source;
return openInputStream(ioHandle, device, config, flags, source, _hidl_cb);
}
#endif
Return<bool> Device::supportsAudioPatches() {
return version() >= AUDIO_DEVICE_API_VERSION_3_0;
}
@@ -256,32 +277,72 @@ Return<Result> Device::setAudioPortConfig(const AudioPortConfig& config) {
return Result::NOT_SUPPORTED;
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<AudioHwSync> Device::getHwAvSync() {
int halHwAvSync;
Result retval = getParam(AudioParameter::keyHwAvSync, &halHwAvSync);
return retval == Result::OK ? halHwAvSync : AUDIO_HW_SYNC_INVALID;
}
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> Device::getHwAvSync(getHwAvSync_cb _hidl_cb) {
int halHwAvSync;
Result retval = getParam(AudioParameter::keyHwAvSync, &halHwAvSync);
_hidl_cb(retval, halHwAvSync);
return Void();
}
#endif
Return<Result> Device::setScreenState(bool turnedOn) {
return setParam(AudioParameter::keyScreenState, turnedOn);
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> Device::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
getParametersImpl(keys, _hidl_cb);
getParametersImpl({}, keys, _hidl_cb);
return Void();
}
Return<Result> Device::setParameters(const hidl_vec<ParameterValue>& parameters) {
return setParametersImpl(parameters);
return setParametersImpl({} /* context */, parameters);
}
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> Device::getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
getParametersImpl(context, keys, _hidl_cb);
return Void();
}
Return<Result> Device::setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) {
return setParametersImpl(context, parameters);
}
#endif
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> Device::debugDump(const hidl_handle& fd) {
return debug(fd, {});
}
#endif
Return<void> Device::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& /* options */) {
if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
analyzeStatus("dump", mDevice->dump(mDevice, fd->data[0]));
}
return Void();
}
#ifdef AUDIO_HAL_VERSION_4_0
Return<void> Device::getMicrophones(getMicrophones_cb _hidl_cb) {
// TODO return device microphones
_hidl_cb(Result::NOT_SUPPORTED, {});
return Void();
}
Return<Result> Device::setConnectedState(const DeviceAddress& address, bool connected) {
auto key = connected ? AudioParameter::keyStreamConnect : AudioParameter::keyStreamDisconnect;
return setParam(key, address);
}
#endif
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace audio

View File

@@ -37,11 +37,19 @@ using ::android::hardware::hidl_string;
using ::android::sp;
struct DevicesFactory : public IDevicesFactory {
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory follow.
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) override;
#endif
#ifdef AUDIO_HAL_VERSION_4_0
Return<void> openDevice(const hidl_string& device, openDevice_cb _hidl_cb) override;
Return<void> openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) override;
#endif
private:
static const char* deviceToString(IDevicesFactory::Device device);
template <class DeviceShim, class Callback>
Return<void> openDevice(const char* moduleName, Callback _hidl_cb);
Return<void> openDevice(const char* moduleName, openDevice_cb _hidl_cb);
static int loadAudioInterface(const char* if_name, audio_hw_device_t** dev);
};

View File

@@ -26,21 +26,54 @@ namespace audio {
namespace AUDIO_HAL_VERSION {
namespace implementation {
// static
const char* DevicesFactory::deviceToString(IDevicesFactory::Device device) {
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) {
switch (device) {
case IDevicesFactory::Device::PRIMARY:
return AUDIO_HARDWARE_MODULE_ID_PRIMARY;
return openDevice<PrimaryDevice>(AUDIO_HARDWARE_MODULE_ID_PRIMARY, _hidl_cb);
case IDevicesFactory::Device::A2DP:
return AUDIO_HARDWARE_MODULE_ID_A2DP;
return openDevice(AUDIO_HARDWARE_MODULE_ID_A2DP, _hidl_cb);
case IDevicesFactory::Device::USB:
return AUDIO_HARDWARE_MODULE_ID_USB;
return openDevice(AUDIO_HARDWARE_MODULE_ID_USB, _hidl_cb);
case IDevicesFactory::Device::R_SUBMIX:
return AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX;
return openDevice(AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX, _hidl_cb);
case IDevicesFactory::Device::STUB:
return AUDIO_HARDWARE_MODULE_ID_STUB;
return openDevice(AUDIO_HARDWARE_MODULE_ID_STUB, _hidl_cb);
}
return nullptr;
_hidl_cb(Result::INVALID_ARGUMENTS, nullptr);
return Void();
}
#endif
#ifdef AUDIO_HAL_VERSION_4_0
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<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);
}
template <class DeviceShim, class Callback>
Return<void> DevicesFactory::openDevice(const char* moduleName, Callback _hidl_cb) {
audio_hw_device_t* halDevice;
Result retval(Result::INVALID_ARGUMENTS);
sp<DeviceShim> result;
int halStatus = loadAudioInterface(moduleName, &halDevice);
if (halStatus == OK) {
result = new DeviceShim(halDevice);
retval = Result::OK;
} else if (halStatus == -EINVAL) {
retval = Result::NOT_INITIALIZED;
}
_hidl_cb(retval, result);
return Void();
}
// static
@@ -73,30 +106,6 @@ out:
return rc;
}
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory follow.
Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) {
audio_hw_device_t* halDevice;
Result retval(Result::INVALID_ARGUMENTS);
sp<IDevice> result;
const char* moduleName = deviceToString(device);
if (moduleName != nullptr) {
int halStatus = loadAudioInterface(moduleName, &halDevice);
if (halStatus == OK) {
if (device == IDevicesFactory::Device::PRIMARY) {
result = new PrimaryDevice(halDevice);
} else {
result = new ::android::hardware::audio::AUDIO_HAL_VERSION::implementation::Device(
halDevice);
}
retval = Result::OK;
} else if (halStatus == -EINVAL) {
retval = Result::NOT_INITIALIZED;
}
}
_hidl_cb(retval, result);
return Void();
}
IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* /* name */) {
return new DevicesFactory();
}

View File

@@ -28,6 +28,7 @@ namespace audio {
namespace AUDIO_HAL_VERSION {
namespace implementation {
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::hidl_string;
@@ -37,16 +38,18 @@ class ParametersUtil {
public:
Result getParam(const char* name, bool* value);
Result getParam(const char* name, int* value);
Result getParam(const char* name, String8* value);
Result getParam(const char* name, String8* value, AudioParameter context = {});
void getParametersImpl(
const hidl_vec<hidl_string>& keys,
const hidl_vec<ParameterValue>& context, const hidl_vec<hidl_string>& keys,
std::function<void(Result retval, const hidl_vec<ParameterValue>& parameters)> cb);
std::unique_ptr<AudioParameter> getParams(const AudioParameter& keys);
Result setParam(const char* name, bool value);
Result setParam(const char* name, int value);
Result setParam(const char* name, const char* value);
Result setParametersImpl(const hidl_vec<ParameterValue>& parameters);
Result setParam(const char* name, float value);
Result setParametersImpl(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters);
Result setParams(const AudioParameter& param);
Result setParam(const char* name, const DeviceAddress& address);
protected:
virtual ~ParametersUtil() {}

View File

@@ -15,6 +15,8 @@
*/
#include <common/all-versions/IncludeGuard.h>
#include <core/all-versions/default/Conversions.h>
#include <system/audio.h>
namespace android {
namespace hardware {
@@ -62,18 +64,20 @@ Result ParametersUtil::getParam(const char* name, int* value) {
return getHalStatusToResult(params->getInt(halName, *value));
}
Result ParametersUtil::getParam(const char* name, String8* value) {
Result ParametersUtil::getParam(const char* name, String8* value, AudioParameter context) {
const String8 halName(name);
AudioParameter keys;
keys.addKey(halName);
std::unique_ptr<AudioParameter> params = getParams(keys);
context.addKey(halName);
std::unique_ptr<AudioParameter> params = getParams(context);
return getHalStatusToResult(params->get(halName, *value));
}
void ParametersUtil::getParametersImpl(
const hidl_vec<hidl_string>& keys,
const hidl_vec<ParameterValue>& context, const hidl_vec<hidl_string>& keys,
std::function<void(Result retval, const hidl_vec<ParameterValue>& parameters)> cb) {
AudioParameter halKeys;
for (auto& pair : context) {
halKeys.add(String8(pair.key.c_str()), String8(pair.value.c_str()));
}
for (size_t i = 0; i < keys.size(); ++i) {
halKeys.addKey(String8(keys[i].c_str()));
}
@@ -120,19 +124,28 @@ Result ParametersUtil::setParam(const char* name, int value) {
return setParams(param);
}
Result ParametersUtil::setParam(const char* name, const char* value) {
Result ParametersUtil::setParam(const char* name, float value) {
AudioParameter param;
param.add(String8(name), String8(value));
param.addFloat(String8(name), value);
return setParams(param);
}
Result ParametersUtil::setParametersImpl(const hidl_vec<ParameterValue>& parameters) {
Result ParametersUtil::setParametersImpl(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) {
AudioParameter params;
for (auto& pair : context) {
params.add(String8(pair.key.c_str()), String8(pair.value.c_str()));
}
for (size_t i = 0; i < parameters.size(); ++i) {
params.add(String8(parameters[i].key.c_str()), String8(parameters[i].value.c_str()));
}
return setParams(params);
}
Result ParametersUtil::setParam(const char* name, const DeviceAddress& address) {
AudioParameter params(String8(deviceAddressToHal(address).c_str()));
params.addInt(String8(name), int(address.device));
return setParams(params);
}
Result ParametersUtil::setParams(const AudioParameter& param) {
int halStatus = halSetParameters(param.toString().string());

View File

@@ -59,12 +59,24 @@ struct PrimaryDevice : public IPrimaryDevice {
Return<void> getMasterMute(getMasterMute_cb _hidl_cb) override;
Return<void> getInputBufferSize(const AudioConfig& config,
getInputBufferSize_cb _hidl_cb) override;
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioOutputFlag flags,
const AudioConfig& config, AudioOutputFlagBitfield flags,
#ifdef AUDIO_HAL_VERSION_4_0
const SourceMetadata& sourceMetadata,
#endif
openOutputStream_cb _hidl_cb) override;
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlag flags,
AudioSource source, openInputStream_cb _hidl_cb) override;
const AudioConfig& config, AudioInputFlagBitfield flags,
AudioSource source, openInputStream_cb _hidl_cb);
#ifdef AUDIO_HAL_VERSION_4_0
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlagBitfield flags,
const SinkMetadata& sinkMetadata,
openInputStream_cb _hidl_cb) override;
#endif
Return<bool> supportsAudioPatches() override;
Return<void> createAudioPatch(const hidl_vec<AudioPortConfig>& sources,
const hidl_vec<AudioPortConfig>& sinks,
@@ -72,12 +84,27 @@ struct PrimaryDevice : public IPrimaryDevice {
Return<Result> releaseAudioPatch(int32_t patch) override;
Return<void> getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) override;
Return<Result> setAudioPortConfig(const AudioPortConfig& config) override;
Return<AudioHwSync> getHwAvSync() override;
Return<Result> setScreenState(bool turnedOn) override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<AudioHwSync> getHwAvSync() override;
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
Return<void> debugDump(const hidl_handle& fd) override;
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> getHwAvSync(getHwAvSync_cb _hidl_cb) override;
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) override;
Return<void> getMicrophones(getMicrophones_cb _hidl_cb) override;
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
#endif
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
Return<Result> setVoiceVolume(float volume) override;
@@ -91,6 +118,15 @@ struct PrimaryDevice : public IPrimaryDevice {
Return<void> getHacEnabled(getHacEnabled_cb _hidl_cb) override;
Return<Result> setHacEnabled(bool enabled) override;
#ifdef AUDIO_HAL_VERSION_4_0
Return<Result> setBtScoHeadsetDebugName(const hidl_string& name) override;
Return<void> getBtHfpEnabled(getBtHfpEnabled_cb _hidl_cb) override;
Return<Result> setBtHfpEnabled(bool enabled) override;
Return<Result> setBtHfpSampleRate(uint32_t sampleRateHz) override;
Return<Result> setBtHfpVolume(float volume) override;
Return<Result> updateRotation(IPrimaryDevice::Rotation rotation) override;
#endif
private:
sp<Device> mDevice;

View File

@@ -60,17 +60,35 @@ Return<void> PrimaryDevice::getInputBufferSize(const AudioConfig& config,
return mDevice->getInputBufferSize(config, _hidl_cb);
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> PrimaryDevice::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioOutputFlag flags,
const AudioConfig& config,
AudioOutputFlagBitfield flags,
openOutputStream_cb _hidl_cb) {
return mDevice->openOutputStream(ioHandle, device, config, flags, _hidl_cb);
}
Return<void> PrimaryDevice::openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlag flags,
const AudioConfig& config, AudioInputFlagBitfield flags,
AudioSource source, openInputStream_cb _hidl_cb) {
return mDevice->openInputStream(ioHandle, device, config, flags, source, _hidl_cb);
}
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> PrimaryDevice::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config,
AudioOutputFlagBitfield flags,
const SourceMetadata& sourceMetadata,
openOutputStream_cb _hidl_cb) {
return mDevice->openOutputStream(ioHandle, device, config, flags, sourceMetadata, _hidl_cb);
}
Return<void> PrimaryDevice::openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlagBitfield flags,
const SinkMetadata& sinkMetadata,
openInputStream_cb _hidl_cb) {
return mDevice->openInputStream(ioHandle, device, config, flags, sinkMetadata, _hidl_cb);
}
#endif
Return<bool> PrimaryDevice::supportsAudioPatches() {
return mDevice->supportsAudioPatches();
@@ -94,14 +112,15 @@ Return<Result> PrimaryDevice::setAudioPortConfig(const AudioPortConfig& config)
return mDevice->setAudioPortConfig(config);
}
Return<AudioHwSync> PrimaryDevice::getHwAvSync() {
return mDevice->getHwAvSync();
}
Return<Result> PrimaryDevice::setScreenState(bool turnedOn) {
return mDevice->setScreenState(turnedOn);
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<AudioHwSync> PrimaryDevice::getHwAvSync() {
return mDevice->getHwAvSync();
}
Return<void> PrimaryDevice::getParameters(const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) {
return mDevice->getParameters(keys, _hidl_cb);
@@ -114,6 +133,26 @@ Return<Result> PrimaryDevice::setParameters(const hidl_vec<ParameterValue>& para
Return<void> PrimaryDevice::debugDump(const hidl_handle& fd) {
return mDevice->debugDump(fd);
}
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> PrimaryDevice::getHwAvSync(getHwAvSync_cb _hidl_cb) {
return mDevice->getHwAvSync(_hidl_cb);
}
Return<void> PrimaryDevice::getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) {
return mDevice->getParameters(context, keys, _hidl_cb);
}
Return<Result> PrimaryDevice::setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) {
return mDevice->setParameters(context, parameters);
}
Return<void> PrimaryDevice::getMicrophones(getMicrophones_cb _hidl_cb) {
return mDevice->getMicrophones(_hidl_cb);
}
Return<Result> PrimaryDevice::setConnectedState(const DeviceAddress& address, bool connected) {
return mDevice->setConnectedState(address, connected);
}
#endif
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
Return<Result> PrimaryDevice::setVoiceVolume(float volume) {
@@ -188,6 +227,35 @@ Return<Result> PrimaryDevice::setHacEnabled(bool enabled) {
return mDevice->setParam(AUDIO_PARAMETER_KEY_HAC, enabled);
}
#ifdef AUDIO_HAL_VERSION_4_0
Return<Result> PrimaryDevice::setBtScoHeadsetDebugName(const hidl_string& name) {
return mDevice->setParam(AUDIO_PARAMETER_KEY_BT_SCO_HEADSET_NAME, name.c_str());
}
Return<void> PrimaryDevice::getBtHfpEnabled(getBtHfpEnabled_cb _hidl_cb) {
bool enabled;
Result retval = mDevice->getParam(AUDIO_PARAMETER_KEY_HFP_ENABLE, &enabled);
_hidl_cb(retval, enabled);
return Void();
}
Return<Result> PrimaryDevice::setBtHfpEnabled(bool enabled) {
return mDevice->setParam(AUDIO_PARAMETER_KEY_HFP_ENABLE, enabled);
}
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) {
return mDevice->setParam(AUDIO_PARAMETER_KEY_HFP_VOLUME, volume);
}
Return<Result> PrimaryDevice::updateRotation(IPrimaryDevice::Rotation rotation) {
// legacy API expects the rotation in degree
return mDevice->setParam(AUDIO_PARAMETER_KEY_ROTATION, int(rotation) * 90);
}
#endif
Return<void> PrimaryDevice::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) {
return mDevice->debug(fd, options);
}
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace audio

View File

@@ -23,6 +23,8 @@
#include <hidl/MQDescriptor.h>
#include <VersionUtils.h>
namespace android {
namespace hardware {
namespace audio {
@@ -32,6 +34,7 @@ namespace implementation {
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
@@ -57,11 +60,15 @@ struct Stream : public IStream, public ParametersUtil {
Return<uint64_t> getFrameCount() override;
Return<uint64_t> getBufferSize() override;
Return<uint32_t> getSampleRate() override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
Return<AudioChannelMask> getChannelMask() override;
Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
Return<Result> setChannelMask(AudioChannelMask mask) override;
#endif
Return<void> getSupportedSampleRates(AudioFormat format, getSupportedSampleRates_cb _hidl_cb);
Return<void> getSupportedChannelMasks(AudioFormat format, getSupportedChannelMasks_cb _hidl_cb);
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
Return<AudioChannelBitfield> getChannelMask() override;
Return<Result> setChannelMask(AudioChannelBitfield mask) override;
Return<AudioFormat> getFormat() override;
Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
Return<Result> setFormat(AudioFormat format) override;
@@ -69,20 +76,34 @@ struct Stream : public IStream, public ParametersUtil {
Return<Result> addEffect(uint64_t effectId) override;
Return<Result> removeEffect(uint64_t effectId) override;
Return<Result> standby() override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<AudioDevice> getDevice() override;
Return<Result> setDevice(const DeviceAddress& address) override;
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
Return<void> debugDump(const hidl_handle& fd) override;
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> getDevices(getDevices_cb _hidl_cb) override;
Return<Result> setDevices(const hidl_vec<DeviceAddress>& devices) override;
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) override;
#endif
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
Return<Result> start() override;
Return<Result> stop() override;
Return<void> createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override;
Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override;
Return<Result> close() override;
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> debugDump(const hidl_handle& fd) override;
#endif
// Utility methods for extending interfaces.
static Result analyzeStatus(const char* funcName, int status);
static Result analyzeStatus(const char* funcName, int status,

View File

@@ -100,9 +100,22 @@ Return<uint32_t> Stream::getSampleRate() {
return mStream->get_sample_rate(mStream);
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> Stream::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
return getSupportedSampleRates(getFormat(), _hidl_cb);
}
Return<void> Stream::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
return getSupportedChannelMasks(getFormat(), _hidl_cb);
}
#endif
Return<void> Stream::getSupportedSampleRates(AudioFormat format,
getSupportedSampleRates_cb _hidl_cb) {
AudioParameter context;
context.addInt(String8(AUDIO_PARAMETER_STREAM_FORMAT), int(format));
String8 halListValue;
Result result = getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue);
Result result =
getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue, context);
hidl_vec<uint32_t> sampleRates;
SortedVector<uint32_t> halSampleRates;
if (result == Result::OK) {
@@ -110,7 +123,36 @@ Return<void> Stream::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb
samplingRatesFromString(halListValue.string(), AudioParameter::valueListSeparator);
sampleRates.setToExternal(halSampleRates.editArray(), halSampleRates.size());
}
#ifdef AUDIO_HAL_VERSION_2_0
_hidl_cb(sampleRates);
#endif
#ifdef AUDIO_HAL_VERSION_4_0
_hidl_cb(result, sampleRates);
#endif
return Void();
}
Return<void> Stream::getSupportedChannelMasks(AudioFormat format,
getSupportedChannelMasks_cb _hidl_cb) {
AudioParameter context;
context.addInt(String8(AUDIO_PARAMETER_STREAM_FORMAT), int(format));
String8 halListValue;
Result result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue, context);
hidl_vec<AudioChannelBitfield> channelMasks;
SortedVector<audio_channel_mask_t> halChannelMasks;
if (result == Result::OK) {
halChannelMasks =
channelMasksFromString(halListValue.string(), AudioParameter::valueListSeparator);
channelMasks.resize(halChannelMasks.size());
for (size_t i = 0; i < halChannelMasks.size(); ++i) {
channelMasks[i] = AudioChannelBitfield(halChannelMasks[i]);
}
}
#ifdef AUDIO_HAL_VERSION_2_0
_hidl_cb(channelMasks);
#elif defined(AUDIO_HAL_VERSION_4_0)
_hidl_cb(result, channelMasks);
#endif
return Void();
}
@@ -118,28 +160,11 @@ Return<Result> Stream::setSampleRate(uint32_t sampleRateHz) {
return setParam(AudioParameter::keySamplingRate, static_cast<int>(sampleRateHz));
}
Return<AudioChannelMask> Stream::getChannelMask() {
return AudioChannelMask(mStream->get_channels(mStream));
Return<AudioChannelBitfield> Stream::getChannelMask() {
return AudioChannelBitfield(mStream->get_channels(mStream));
}
Return<void> Stream::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
String8 halListValue;
Result result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue);
hidl_vec<AudioChannelMask> channelMasks;
SortedVector<audio_channel_mask_t> halChannelMasks;
if (result == Result::OK) {
halChannelMasks =
channelMasksFromString(halListValue.string(), AudioParameter::valueListSeparator);
channelMasks.resize(halChannelMasks.size());
for (size_t i = 0; i < halChannelMasks.size(); ++i) {
channelMasks[i] = AudioChannelMask(halChannelMasks[i]);
}
}
_hidl_cb(channelMasks);
return Void();
}
Return<Result> Stream::setChannelMask(AudioChannelMask mask) {
Return<Result> Stream::setChannelMask(AudioChannelBitfield mask) {
return setParam(AudioParameter::keyChannels, static_cast<int>(mask));
}
@@ -171,7 +196,7 @@ Return<void> Stream::getAudioProperties(getAudioProperties_cb _hidl_cb) {
uint32_t halSampleRate = mStream->get_sample_rate(mStream);
audio_channel_mask_t halMask = mStream->get_channels(mStream);
audio_format_t halFormat = mStream->get_format(mStream);
_hidl_cb(halSampleRate, AudioChannelMask(halMask), AudioFormat(halFormat));
_hidl_cb(halSampleRate, AudioChannelBitfield(halMask), AudioFormat(halFormat));
return Void();
}
@@ -200,48 +225,73 @@ Return<Result> Stream::standby() {
return analyzeStatus("standby", mStream->standby(mStream));
}
Return<Result> Stream::setHwAvSync(uint32_t hwAvSync) {
return setParam(AudioParameter::keyStreamHwAvSync, static_cast<int>(hwAvSync));
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<AudioDevice> Stream::getDevice() {
int device;
int device = 0;
Result retval = getParam(AudioParameter::keyRouting, &device);
return retval == Result::OK ? static_cast<AudioDevice>(device) : AudioDevice::NONE;
}
Return<Result> Stream::setDevice(const DeviceAddress& address) {
char* halDeviceAddress = audio_device_address_to_parameter(
static_cast<audio_devices_t>(address.device), deviceAddressToHal(address).c_str());
AudioParameter params((String8(halDeviceAddress)));
free(halDeviceAddress);
params.addInt(String8(AudioParameter::keyRouting),
static_cast<audio_devices_t>(address.device));
return setParams(params);
return setParam(AudioParameter::keyRouting, address);
}
Return<void> Stream::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
getParametersImpl({} /* context */, keys, _hidl_cb);
return Void();
}
Return<Result> Stream::setParameters(const hidl_vec<ParameterValue>& parameters) {
return setParametersImpl({} /* context */, parameters);
}
Return<Result> Stream::setConnectedState(const DeviceAddress& address, bool connected) {
return setParam(
connected ? AudioParameter::keyStreamConnect : AudioParameter::keyStreamDisconnect,
deviceAddressToHal(address).c_str());
address);
}
Return<Result> Stream::setHwAvSync(uint32_t hwAvSync) {
return setParam(AudioParameter::keyStreamHwAvSync, static_cast<int>(hwAvSync));
}
Return<void> Stream::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
getParametersImpl(keys, _hidl_cb);
return Void();
}
Return<Result> Stream::setParameters(const hidl_vec<ParameterValue>& parameters) {
return setParametersImpl(parameters);
}
Return<void> Stream::debugDump(const hidl_handle& fd) {
if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
analyzeStatus("dump", mStream->dump(mStream, fd->data[0]));
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> Stream::getDevices(getDevices_cb _hidl_cb) {
int device = 0;
Result retval = getParam(AudioParameter::keyRouting, &device);
hidl_vec<DeviceAddress> devices;
if (retval == Result::OK) {
devices.resize(1);
devices[0].device = static_cast<AudioDevice>(device);
}
_hidl_cb(retval, devices);
return Void();
}
Return<Result> Stream::setDevices(const hidl_vec<DeviceAddress>& devices) {
// FIXME: can the legacy API set multiple device with address ?
if (devices.size() > 1) {
return Result::NOT_SUPPORTED;
}
DeviceAddress address;
if (devices.size() == 1) {
address = devices[0];
} else {
address.device = AudioDevice::NONE;
}
return setParam(AudioParameter::keyRouting, address);
}
Return<void> Stream::getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
getParametersImpl(context, keys, _hidl_cb);
return Void();
}
Return<Result> Stream::setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) {
return setParametersImpl(context, parameters);
}
#endif
Return<Result> Stream::start() {
return Result::NOT_SUPPORTED;
}
@@ -269,6 +319,19 @@ Return<Result> Stream::close() {
return Result::NOT_SUPPORTED;
}
Return<void> Stream::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& /* options */) {
if (fd.getNativeHandle() != nullptr && fd->numFds == 1) {
analyzeStatus("dump", mStream->dump(mStream, fd->data[0]));
}
return Void();
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> Stream::debugDump(const hidl_handle& fd) {
return debug(fd, {} /* options */);
}
#endif
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace audio

View File

@@ -58,11 +58,15 @@ struct StreamIn : public IStreamIn {
Return<uint64_t> getFrameCount() override;
Return<uint64_t> getBufferSize() override;
Return<uint32_t> getSampleRate() override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
Return<AudioChannelMask> getChannelMask() override;
Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
Return<Result> setChannelMask(AudioChannelMask mask) override;
#endif
Return<void> getSupportedSampleRates(AudioFormat format, getSupportedSampleRates_cb _hidl_cb);
Return<void> getSupportedChannelMasks(AudioFormat format, getSupportedChannelMasks_cb _hidl_cb);
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
Return<AudioChannelBitfield> getChannelMask() override;
Return<Result> setChannelMask(AudioChannelBitfield mask) override;
Return<AudioFormat> getFormat() override;
Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
Return<Result> setFormat(AudioFormat format) override;
@@ -70,16 +74,30 @@ struct StreamIn : public IStreamIn {
Return<Result> addEffect(uint64_t effectId) override;
Return<Result> removeEffect(uint64_t effectId) override;
Return<Result> standby() override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<AudioDevice> getDevice() override;
Return<Result> setDevice(const DeviceAddress& address) override;
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
Return<void> debugDump(const hidl_handle& fd) override;
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> getDevices(getDevices_cb _hidl_cb) override;
Return<Result> setDevices(const hidl_vec<DeviceAddress>& devices) override;
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) override;
#endif
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
Return<Result> close() override;
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> debugDump(const hidl_handle& fd) override;
#endif
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow.
Return<void> getAudioSource(getAudioSource_cb _hidl_cb) override;
Return<Result> setGain(float gain) override;
@@ -91,6 +109,10 @@ struct StreamIn : public IStreamIn {
Return<Result> stop() override;
Return<void> createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override;
Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override;
#ifdef AUDIO_HAL_VERSION_4_0
Return<void> updateSinkMetadata(const SinkMetadata& sinkMetadata) override;
Return<void> getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) override;
#endif
static Result getCapturePositionImpl(audio_stream_in_t* stream, uint64_t* frames,
uint64_t* time);

View File

@@ -179,23 +179,33 @@ Return<uint32_t> StreamIn::getSampleRate() {
return mStreamCommon->getSampleRate();
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> StreamIn::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
}
Return<void> StreamIn::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
return mStreamCommon->getSupportedSampleRates(_hidl_cb);
}
#endif
Return<void> StreamIn::getSupportedChannelMasks(AudioFormat format,
getSupportedChannelMasks_cb _hidl_cb) {
return mStreamCommon->getSupportedChannelMasks(format, _hidl_cb);
}
Return<void> StreamIn::getSupportedSampleRates(AudioFormat format,
getSupportedSampleRates_cb _hidl_cb) {
return mStreamCommon->getSupportedSampleRates(format, _hidl_cb);
}
Return<Result> StreamIn::setSampleRate(uint32_t sampleRateHz) {
return mStreamCommon->setSampleRate(sampleRateHz);
}
Return<AudioChannelMask> StreamIn::getChannelMask() {
Return<AudioChannelBitfield> StreamIn::getChannelMask() {
return mStreamCommon->getChannelMask();
}
Return<void> StreamIn::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
}
Return<Result> StreamIn::setChannelMask(AudioChannelMask mask) {
Return<Result> StreamIn::setChannelMask(AudioChannelBitfield mask) {
return mStreamCommon->setChannelMask(mask);
}
@@ -227,6 +237,15 @@ Return<Result> StreamIn::standby() {
return mStreamCommon->standby();
}
Return<Result> StreamIn::setHwAvSync(uint32_t hwAvSync) {
return mStreamCommon->setHwAvSync(hwAvSync);
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<Result> StreamIn::setConnectedState(const DeviceAddress& address, bool connected) {
return mStreamCommon->setConnectedState(address, connected);
}
Return<AudioDevice> StreamIn::getDevice() {
return mStreamCommon->getDevice();
}
@@ -235,14 +254,6 @@ Return<Result> StreamIn::setDevice(const DeviceAddress& address) {
return mStreamCommon->setDevice(address);
}
Return<Result> StreamIn::setConnectedState(const DeviceAddress& address, bool connected) {
return mStreamCommon->setConnectedState(address, connected);
}
Return<Result> StreamIn::setHwAvSync(uint32_t hwAvSync) {
return mStreamCommon->setHwAvSync(hwAvSync);
}
Return<void> StreamIn::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
return mStreamCommon->getParameters(keys, _hidl_cb);
}
@@ -254,6 +265,24 @@ Return<Result> StreamIn::setParameters(const hidl_vec<ParameterValue>& parameter
Return<void> StreamIn::debugDump(const hidl_handle& fd) {
return mStreamCommon->debugDump(fd);
}
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> StreamIn::getDevices(getDevices_cb _hidl_cb) {
return mStreamCommon->getDevices(_hidl_cb);
}
Return<Result> StreamIn::setDevices(const hidl_vec<DeviceAddress>& devices) {
return mStreamCommon->setDevices(devices);
}
Return<void> StreamIn::getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
return mStreamCommon->getParameters(context, keys, _hidl_cb);
}
Return<Result> StreamIn::setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) {
return mStreamCommon->setParameters(context, parameters);
}
#endif
Return<Result> StreamIn::start() {
return mStreamMmap->start();
@@ -415,6 +444,21 @@ Return<void> StreamIn::getCapturePosition(getCapturePosition_cb _hidl_cb) {
return Void();
}
Return<void> StreamIn::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) {
return mStreamCommon->debug(fd, options);
}
#ifdef AUDIO_HAL_VERSION_4_0
Return<void> StreamIn::updateSinkMetadata(const SinkMetadata& /*sinkMetadata*/) {
return Void(); // TODO: propagate to legacy
}
Return<void> StreamIn::getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) {
_hidl_cb(Result::NOT_SUPPORTED, {}); // TODO: retrieve from legacy
return Void();
}
#endif
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace audio

View File

@@ -60,11 +60,15 @@ struct StreamOut : public IStreamOut {
Return<uint64_t> getFrameCount() override;
Return<uint64_t> getBufferSize() override;
Return<uint32_t> getSampleRate() override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
Return<AudioChannelMask> getChannelMask() override;
Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
Return<Result> setChannelMask(AudioChannelMask mask) override;
#endif
Return<void> getSupportedSampleRates(AudioFormat format, getSupportedSampleRates_cb _hidl_cb);
Return<void> getSupportedChannelMasks(AudioFormat format, getSupportedChannelMasks_cb _hidl_cb);
Return<Result> setSampleRate(uint32_t sampleRateHz) override;
Return<AudioChannelBitfield> getChannelMask() override;
Return<Result> setChannelMask(AudioChannelBitfield mask) override;
Return<AudioFormat> getFormat() override;
Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override;
Return<Result> setFormat(AudioFormat format) override;
@@ -72,16 +76,30 @@ struct StreamOut : public IStreamOut {
Return<Result> addEffect(uint64_t effectId) override;
Return<Result> removeEffect(uint64_t effectId) override;
Return<Result> standby() override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<AudioDevice> getDevice() override;
Return<Result> setDevice(const DeviceAddress& address) override;
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
Return<void> getParameters(const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override;
Return<void> debugDump(const hidl_handle& fd) override;
Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> getDevices(getDevices_cb _hidl_cb) override;
Return<Result> setDevices(const hidl_vec<DeviceAddress>& devices) override;
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) override;
Return<Result> setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) override;
#endif
Return<Result> setHwAvSync(uint32_t hwAvSync) override;
Return<Result> close() override;
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> debugDump(const hidl_handle& fd) override;
#endif
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow.
Return<uint32_t> getLatency() override;
Return<Result> setVolume(float left, float right) override;
@@ -102,6 +120,10 @@ struct StreamOut : public IStreamOut {
Return<Result> stop() override;
Return<void> createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) override;
Return<void> getMmapPosition(getMmapPosition_cb _hidl_cb) override;
#ifdef AUDIO_HAL_VERSION_4_0
Return<void> updateSourceMetadata(const SourceMetadata& sourceMetadata) override;
Return<Result> selectPresentation(int32_t presentationId, int32_t programId) override;
#endif
static Result getPresentationPositionImpl(audio_stream_out_t* stream, uint64_t* frames,
TimeSpec* timeStamp);

View File

@@ -183,23 +183,33 @@ Return<uint32_t> StreamOut::getSampleRate() {
return mStreamCommon->getSampleRate();
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<void> StreamOut::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
}
Return<void> StreamOut::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
return mStreamCommon->getSupportedSampleRates(_hidl_cb);
}
#endif
Return<void> StreamOut::getSupportedChannelMasks(AudioFormat format,
getSupportedChannelMasks_cb _hidl_cb) {
return mStreamCommon->getSupportedChannelMasks(format, _hidl_cb);
}
Return<void> StreamOut::getSupportedSampleRates(AudioFormat format,
getSupportedSampleRates_cb _hidl_cb) {
return mStreamCommon->getSupportedSampleRates(format, _hidl_cb);
}
Return<Result> StreamOut::setSampleRate(uint32_t sampleRateHz) {
return mStreamCommon->setSampleRate(sampleRateHz);
}
Return<AudioChannelMask> StreamOut::getChannelMask() {
Return<AudioChannelBitfield> StreamOut::getChannelMask() {
return mStreamCommon->getChannelMask();
}
Return<void> StreamOut::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
}
Return<Result> StreamOut::setChannelMask(AudioChannelMask mask) {
Return<Result> StreamOut::setChannelMask(AudioChannelBitfield mask) {
return mStreamCommon->setChannelMask(mask);
}
@@ -231,6 +241,15 @@ Return<Result> StreamOut::standby() {
return mStreamCommon->standby();
}
Return<Result> StreamOut::setHwAvSync(uint32_t hwAvSync) {
return mStreamCommon->setHwAvSync(hwAvSync);
}
#ifdef AUDIO_HAL_VERSION_2_0
Return<Result> StreamOut::setConnectedState(const DeviceAddress& address, bool connected) {
return mStreamCommon->setConnectedState(address, connected);
}
Return<AudioDevice> StreamOut::getDevice() {
return mStreamCommon->getDevice();
}
@@ -239,14 +258,6 @@ Return<Result> StreamOut::setDevice(const DeviceAddress& address) {
return mStreamCommon->setDevice(address);
}
Return<Result> StreamOut::setConnectedState(const DeviceAddress& address, bool connected) {
return mStreamCommon->setConnectedState(address, connected);
}
Return<Result> StreamOut::setHwAvSync(uint32_t hwAvSync) {
return mStreamCommon->setHwAvSync(hwAvSync);
}
Return<void> StreamOut::getParameters(const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) {
return mStreamCommon->getParameters(keys, _hidl_cb);
@@ -259,6 +270,25 @@ Return<Result> StreamOut::setParameters(const hidl_vec<ParameterValue>& paramete
Return<void> StreamOut::debugDump(const hidl_handle& fd) {
return mStreamCommon->debugDump(fd);
}
#elif defined(AUDIO_HAL_VERSION_4_0)
Return<void> StreamOut::getDevices(getDevices_cb _hidl_cb) {
return mStreamCommon->getDevices(_hidl_cb);
}
Return<Result> StreamOut::setDevices(const hidl_vec<DeviceAddress>& devices) {
return mStreamCommon->setDevices(devices);
}
Return<void> StreamOut::getParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<hidl_string>& keys,
getParameters_cb _hidl_cb) {
return mStreamCommon->getParameters(context, keys, _hidl_cb);
}
Return<Result> StreamOut::setParameters(const hidl_vec<ParameterValue>& context,
const hidl_vec<ParameterValue>& parameters) {
return mStreamCommon->setParameters(context, parameters);
}
#endif
Return<Result> StreamOut::close() {
if (mIsClosed) return Result::INVALID_STATE;
@@ -512,6 +542,19 @@ Return<void> StreamOut::getMmapPosition(getMmapPosition_cb _hidl_cb) {
return mStreamMmap->getMmapPosition(_hidl_cb);
}
Return<void> StreamOut::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) {
return mStreamCommon->debug(fd, options);
}
#ifdef AUDIO_HAL_VERSION_4_0
Return<void> StreamOut::updateSourceMetadata(const SourceMetadata& /*sourceMetadata*/) {
return Void(); // TODO: propagate to legacy
}
Return<Result> StreamOut::selectPresentation(int32_t /*presentationId*/, int32_t /*programId*/) {
return Result::NOT_SUPPORTED; // TODO: propagate to legacy
}
#endif
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace audio

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "AEC_Effect_HAL"
#include "AcousticEchoCancelerEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/AcousticEchoCancelerEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ACOUSTICECHOCANCELEREFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ACOUSTICECHOCANCELEREFFECT_H
#include <android/hardware/audio/effect/4.0/IAcousticEchoCancelerEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/AcousticEchoCancelerEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ACOUSTICECHOCANCELEREFFECT_H

View File

@@ -0,0 +1,50 @@
cc_library_shared {
name: "android.hardware.audio.effect@4.0-impl",
defaults: ["hidl_defaults"],
vendor: true,
relative_install_path: "hw",
srcs: [
"AcousticEchoCancelerEffect.cpp",
"AudioBufferManager.cpp",
"AutomaticGainControlEffect.cpp",
"BassBoostEffect.cpp",
"Conversions.cpp",
"DownmixEffect.cpp",
"Effect.cpp",
"EffectsFactory.cpp",
"EnvironmentalReverbEffect.cpp",
"EqualizerEffect.cpp",
"LoudnessEnhancerEffect.cpp",
"NoiseSuppressionEffect.cpp",
"PresetReverbEffect.cpp",
"VirtualizerEffect.cpp",
"VisualizerEffect.cpp",
],
shared_libs: [
"libbase",
"libcutils",
"libeffects",
"libfmq",
"libhidlbase",
"libhidlmemory",
"libhidltransport",
"liblog",
"libutils",
"android.hardware.audio.common-util",
"android.hardware.audio.common@4.0",
"android.hardware.audio.common@4.0-util",
"android.hardware.audio.effect@4.0",
"android.hidl.memory@1.0",
],
header_libs: [
"android.hardware.audio.common.util@all-versions",
"android.hardware.audio.effect@all-versions-impl",
"libaudio_system_headers",
"libaudioclient_headers",
"libeffects_headers",
"libhardware_headers",
"libmedia_headers",
],
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "AudioBufferManager.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/AudioBufferManager.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUDIO_BUFFER_MANAGER_H_
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUDIO_BUFFER_MANAGER_H_
#include <android/hardware/audio/effect/4.0/types.h>
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/AudioBufferManager.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUDIO_BUFFER_MANAGER_H_

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "AGC_Effect_HAL"
#include "AutomaticGainControlEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/AutomaticGainControlEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUTOMATICGAINCONTROLEFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUTOMATICGAINCONTROLEFFECT_H
#include <android/hardware/audio/effect/4.0/IAutomaticGainControlEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/AutomaticGainControlEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUTOMATICGAINCONTROLEFFECT_H

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "BassBoost_HAL"
#include "BassBoostEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/BassBoostEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_BASSBOOSTEFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_BASSBOOSTEFFECT_H
#include <android/hardware/audio/effect/4.0/IBassBoostEffect.h>
#include <hidl/MQDescriptor.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/BassBoostEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_BASSBOOSTEFFECT_H

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "Conversions.h"
#include "HidlUtils.h"
using ::android::hardware::audio::common::V4_0::HidlUtils;
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/Conversions.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_CONVERSIONS_H_
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_CONVERSIONS_H_
#include <android/hardware/audio/effect/4.0/types.h>
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/Conversions.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_CONVERSIONS_H_

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "Downmix_HAL"
#include "DownmixEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/DownmixEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_DOWNMIXEFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_DOWNMIXEFFECT_H
#include <android/hardware/audio/effect/4.0/IDownmixEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/DownmixEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_DOWNMIXEFFECT_H

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <memory.h>
#define LOG_TAG "EffectHAL"
#define ATRACE_TAG ATRACE_TAG_AUDIO
#include "Conversions.h"
#include "Effect.h"
#include "common/all-versions/default/EffectMap.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/Effect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECT_H
#include <android/hardware/audio/effect/4.0/IEffect.h>
#include "AudioBufferManager.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/Effect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECT_H

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "EffectFactoryHAL"
#include "EffectsFactory.h"
#include "AcousticEchoCancelerEffect.h"
#include "AutomaticGainControlEffect.h"
#include "BassBoostEffect.h"
#include "Conversions.h"
#include "DownmixEffect.h"
#include "Effect.h"
#include "EnvironmentalReverbEffect.h"
#include "EqualizerEffect.h"
#include "HidlUtils.h"
#include "LoudnessEnhancerEffect.h"
#include "NoiseSuppressionEffect.h"
#include "PresetReverbEffect.h"
#include "VirtualizerEffect.h"
#include "VisualizerEffect.h"
#include "common/all-versions/default/EffectMap.h"
using ::android::hardware::audio::common::V4_0::HidlUtils;
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/EffectsFactory.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECTSFACTORY_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECTSFACTORY_H
#include <system/audio_effect.h>
#include <android/hardware/audio/effect/4.0/IEffectsFactory.h>
#include <hidl/MQDescriptor.h>
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/EffectsFactory.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECTSFACTORY_H

View File

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "EnvReverb_HAL"
#include <android/log.h>
#include "EnvironmentalReverbEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/EnvironmentalReverbEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ENVIRONMENTALREVERBEFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ENVIRONMENTALREVERBEFFECT_H
#include <system/audio_effects/effect_environmentalreverb.h>
#include <android/hardware/audio/effect/4.0/IEnvironmentalReverbEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/EnvironmentalReverbEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ENVIRONMENTALREVERBEFFECT_H

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "Equalizer_HAL"
#include "EqualizerEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/EqualizerEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EQUALIZEREFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EQUALIZEREFFECT_H
#include <android/hardware/audio/effect/4.0/IEqualizerEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/EqualizerEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EQUALIZEREFFECT_H

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "LoudnessEnhancer_HAL"
#include "LoudnessEnhancerEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/LoudnessEnhancerEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_LOUDNESSENHANCEREFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_LOUDNESSENHANCEREFFECT_H
#include <android/hardware/audio/effect/4.0/ILoudnessEnhancerEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/LoudnessEnhancerEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_LOUDNESSENHANCEREFFECT_H

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "NS_Effect_HAL"
#include "NoiseSuppressionEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/NoiseSuppressionEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_NOISESUPPRESSIONEFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_NOISESUPPRESSIONEFFECT_H
#include <android/hardware/audio/effect/4.0/INoiseSuppressionEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/NoiseSuppressionEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_NOISESUPPRESSIONEFFECT_H

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "PresetReverb_HAL"
#include "PresetReverbEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/PresetReverbEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_PRESETREVERBEFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_PRESETREVERBEFFECT_H
#include <android/hardware/audio/effect/4.0/IPresetReverbEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/PresetReverbEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_PRESETREVERBEFFECT_H

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "Virtualizer_HAL"
#include "VirtualizerEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/VirtualizerEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VIRTUALIZEREFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VIRTUALIZEREFFECT_H
#include <android/hardware/audio/effect/4.0/IVirtualizerEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/VirtualizerEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VIRTUALIZEREFFECT_H

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "Visualizer_HAL"
#include "VisualizerEffect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/VisualizerEffect.impl.h>
#undef AUDIO_HAL_VERSION

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VISUALIZEREFFECT_H
#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VISUALIZEREFFECT_H
#include <android/hardware/audio/effect/4.0/IVisualizerEffect.h>
#include "Effect.h"
#define AUDIO_HAL_VERSION V4_0
#include <effect/all-versions/default/VisualizerEffect.h>
#undef AUDIO_HAL_VERSION
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VISUALIZEREFFECT_H

View File

@@ -20,6 +20,8 @@
#include <hidl/MQDescriptor.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -46,7 +48,7 @@ struct AcousticEchoCancelerEffect : public IAcousticEchoCancelerEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -54,7 +56,7 @@ struct AcousticEchoCancelerEffect : public IAcousticEchoCancelerEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

View File

@@ -19,6 +19,8 @@
#include <android/log.h>
#include <system/audio_effects/effect_aec.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -54,7 +56,7 @@ Return<Result> AcousticEchoCancelerEffect::disable() {
return mEffect->disable();
}
Return<Result> AcousticEchoCancelerEffect::setDevice(AudioDevice device) {
Return<Result> AcousticEchoCancelerEffect::setDevice(AudioDeviceBitfield device) {
return mEffect->setDevice(device);
}
@@ -78,7 +80,7 @@ Return<Result> AcousticEchoCancelerEffect::setConfigReverse(
return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
}
Return<Result> AcousticEchoCancelerEffect::setInputDevice(AudioDevice device) {
Return<Result> AcousticEchoCancelerEffect::setInputDevice(AudioDeviceBitfield device) {
return mEffect->setInputDevice(device);
}

View File

@@ -22,6 +22,8 @@
#include <hidl/MQDescriptor.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -48,7 +50,7 @@ struct AutomaticGainControlEffect : public IAutomaticGainControlEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -56,7 +58,7 @@ struct AutomaticGainControlEffect : public IAutomaticGainControlEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

View File

@@ -18,6 +18,8 @@
#include <android/log.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -67,7 +69,7 @@ Return<Result> AutomaticGainControlEffect::disable() {
return mEffect->disable();
}
Return<Result> AutomaticGainControlEffect::setDevice(AudioDevice device) {
Return<Result> AutomaticGainControlEffect::setDevice(AudioDeviceBitfield device) {
return mEffect->setDevice(device);
}
@@ -91,7 +93,7 @@ Return<Result> AutomaticGainControlEffect::setConfigReverse(
return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
}
Return<Result> AutomaticGainControlEffect::setInputDevice(AudioDevice device) {
Return<Result> AutomaticGainControlEffect::setInputDevice(AudioDeviceBitfield device) {
return mEffect->setInputDevice(device);
}

View File

@@ -20,6 +20,8 @@
#include <hidl/MQDescriptor.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -46,7 +48,7 @@ struct BassBoostEffect : public IBassBoostEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -54,7 +56,7 @@ struct BassBoostEffect : public IBassBoostEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

View File

@@ -19,6 +19,8 @@
#include <android/log.h>
#include <system/audio_effects/effect_bassboost.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -53,7 +55,7 @@ Return<Result> BassBoostEffect::disable() {
return mEffect->disable();
}
Return<Result> BassBoostEffect::setDevice(AudioDevice device) {
Return<Result> BassBoostEffect::setDevice(AudioDeviceBitfield device) {
return mEffect->setDevice(device);
}
@@ -76,7 +78,7 @@ Return<Result> BassBoostEffect::setConfigReverse(
return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
}
Return<Result> BassBoostEffect::setInputDevice(AudioDevice device) {
Return<Result> BassBoostEffect::setInputDevice(AudioDeviceBitfield device) {
return mEffect->setInputDevice(device);
}

View File

@@ -20,6 +20,8 @@
#include <hidl/MQDescriptor.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -46,7 +48,7 @@ struct DownmixEffect : public IDownmixEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -54,7 +56,7 @@ struct DownmixEffect : public IDownmixEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

View File

@@ -19,6 +19,8 @@
#include <android/log.h>
#include <system/audio_effects/effect_downmix.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -53,7 +55,7 @@ Return<Result> DownmixEffect::disable() {
return mEffect->disable();
}
Return<Result> DownmixEffect::setDevice(AudioDevice device) {
Return<Result> DownmixEffect::setDevice(AudioDeviceBitfield device) {
return mEffect->setDevice(device);
}
@@ -76,7 +78,7 @@ Return<Result> DownmixEffect::setConfigReverse(
return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
}
Return<Result> DownmixEffect::setInputDevice(AudioDevice device) {
Return<Result> DownmixEffect::setInputDevice(AudioDeviceBitfield device) {
return mEffect->setInputDevice(device);
}

View File

@@ -28,6 +28,8 @@
#include <hardware/audio_effect.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -39,6 +41,7 @@ using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioDeviceBitfield;
using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
@@ -69,7 +72,7 @@ struct Effect : public IEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -77,7 +80,7 @@ struct Effect : public IEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

View File

@@ -24,6 +24,8 @@
#include <media/EffectsFactoryApi.h>
#include <utils/Trace.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -33,6 +35,7 @@ namespace implementation {
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield;
using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::MessageQueueFlagBits;
namespace {
@@ -174,8 +177,8 @@ std::unique_ptr<uint8_t[]> Effect::hidlVecToHal(const hidl_vec<T>& vec, uint32_t
// static
void Effect::effectAuxChannelsConfigFromHal(const channel_config_t& halConfig,
EffectAuxChannelsConfig* config) {
config->mainChannels = AudioChannelMask(halConfig.main_channels);
config->auxChannels = AudioChannelMask(halConfig.aux_channels);
config->mainChannels = AudioChannelBitfield(halConfig.main_channels);
config->auxChannels = AudioChannelBitfield(halConfig.aux_channels);
}
// static
@@ -191,10 +194,10 @@ void Effect::effectBufferConfigFromHal(const buffer_config_t& halConfig,
config->buffer.id = 0;
config->buffer.frameCount = 0;
config->samplingRateHz = halConfig.samplingRate;
config->channels = AudioChannelMask(halConfig.channels);
config->channels = AudioChannelBitfield(halConfig.channels);
config->format = AudioFormat(halConfig.format);
config->accessMode = EffectBufferAccess(halConfig.accessMode);
config->mask = EffectConfigParameters(halConfig.mask);
config->mask = static_cast<decltype(config->mask)>(halConfig.mask);
}
// static
@@ -500,7 +503,7 @@ Return<Result> Effect::disable() {
return sendCommandReturningStatus(EFFECT_CMD_DISABLE, "DISABLE");
}
Return<Result> Effect::setDevice(AudioDevice device) {
Return<Result> Effect::setDevice(AudioDeviceBitfield device) {
uint32_t halDevice = static_cast<uint32_t>(device);
return sendCommand(EFFECT_CMD_SET_DEVICE, "SET_DEVICE", sizeof(uint32_t), &halDevice);
}
@@ -539,7 +542,7 @@ Return<Result> Effect::setConfigReverse(
inputBufferProvider, outputBufferProvider);
}
Return<Result> Effect::setInputDevice(AudioDevice device) {
Return<Result> Effect::setInputDevice(AudioDeviceBitfield device) {
uint32_t halDevice = static_cast<uint32_t>(device);
return sendCommand(EFFECT_CMD_SET_INPUT_DEVICE, "SET_INPUT_DEVICE", sizeof(uint32_t),
&halDevice);

View File

@@ -46,7 +46,7 @@ struct EffectsFactory : public IEffectsFactory {
Return<void> getDescriptor(const Uuid& uid, getDescriptor_cb _hidl_cb) override;
Return<void> createEffect(const Uuid& uid, int32_t session, int32_t ioHandle,
createEffect_cb _hidl_cb) override;
Return<void> debugDump(const hidl_handle& fd) override;
Return<void> debugDump(const hidl_handle& fd);
private:
static sp<IEffect> dispatchEffectInstanceCreation(const effect_descriptor_t& halDescriptor,

View File

@@ -22,6 +22,8 @@
#include <hidl/MQDescriptor.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -58,7 +60,7 @@ struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -66,7 +68,7 @@ struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

View File

@@ -18,6 +18,8 @@
#include <android/log.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -81,7 +83,7 @@ Return<Result> EnvironmentalReverbEffect::disable() {
return mEffect->disable();
}
Return<Result> EnvironmentalReverbEffect::setDevice(AudioDevice device) {
Return<Result> EnvironmentalReverbEffect::setDevice(AudioDeviceBitfield device) {
return mEffect->setDevice(device);
}
@@ -105,7 +107,7 @@ Return<Result> EnvironmentalReverbEffect::setConfigReverse(
return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
}
Return<Result> EnvironmentalReverbEffect::setInputDevice(AudioDevice device) {
Return<Result> EnvironmentalReverbEffect::setInputDevice(AudioDeviceBitfield device) {
return mEffect->setInputDevice(device);
}

View File

@@ -24,6 +24,8 @@
#include <hidl/MQDescriptor.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -60,7 +62,7 @@ struct EqualizerEffect : public IEqualizerEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -68,7 +70,7 @@ struct EqualizerEffect : public IEqualizerEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

View File

@@ -20,6 +20,8 @@
#include <android/log.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -76,7 +78,7 @@ Return<Result> EqualizerEffect::disable() {
return mEffect->disable();
}
Return<Result> EqualizerEffect::setDevice(AudioDevice device) {
Return<Result> EqualizerEffect::setDevice(AudioDeviceBitfield device) {
return mEffect->setDevice(device);
}
@@ -99,7 +101,7 @@ Return<Result> EqualizerEffect::setConfigReverse(
return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
}
Return<Result> EqualizerEffect::setInputDevice(AudioDevice device) {
Return<Result> EqualizerEffect::setInputDevice(AudioDeviceBitfield device) {
return mEffect->setInputDevice(device);
}

View File

@@ -20,6 +20,8 @@
#include <hidl/MQDescriptor.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -56,7 +58,7 @@ struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -64,7 +66,7 @@ struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

View File

@@ -21,6 +21,8 @@
#include <android/log.h>
#include <system/audio_effects/effect_aec.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -56,7 +58,7 @@ Return<Result> LoudnessEnhancerEffect::disable() {
return mEffect->disable();
}
Return<Result> LoudnessEnhancerEffect::setDevice(AudioDevice device) {
Return<Result> LoudnessEnhancerEffect::setDevice(AudioDeviceBitfield device) {
return mEffect->setDevice(device);
}
@@ -79,7 +81,7 @@ Return<Result> LoudnessEnhancerEffect::setConfigReverse(
return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
}
Return<Result> LoudnessEnhancerEffect::setInputDevice(AudioDevice device) {
Return<Result> LoudnessEnhancerEffect::setInputDevice(AudioDeviceBitfield device) {
return mEffect->setInputDevice(device);
}

View File

@@ -22,6 +22,8 @@
#include <hidl/MQDescriptor.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -58,7 +60,7 @@ struct NoiseSuppressionEffect : public INoiseSuppressionEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -66,7 +68,7 @@ struct NoiseSuppressionEffect : public INoiseSuppressionEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

View File

@@ -18,6 +18,8 @@
#include <android/log.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -65,7 +67,7 @@ Return<Result> NoiseSuppressionEffect::disable() {
return mEffect->disable();
}
Return<Result> NoiseSuppressionEffect::setDevice(AudioDevice device) {
Return<Result> NoiseSuppressionEffect::setDevice(AudioDeviceBitfield device) {
return mEffect->setDevice(device);
}
@@ -88,7 +90,7 @@ Return<Result> NoiseSuppressionEffect::setConfigReverse(
return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
}
Return<Result> NoiseSuppressionEffect::setInputDevice(AudioDevice device) {
Return<Result> NoiseSuppressionEffect::setInputDevice(AudioDeviceBitfield device) {
return mEffect->setInputDevice(device);
}

View File

@@ -20,6 +20,8 @@
#include <hidl/MQDescriptor.h>
#include "VersionUtils.h"
namespace android {
namespace hardware {
namespace audio {
@@ -56,7 +58,7 @@ struct PresetReverbEffect : public IPresetReverbEffect {
Return<Result> reset() override;
Return<Result> enable() override;
Return<Result> disable() override;
Return<Result> setDevice(AudioDevice device) override;
Return<Result> setDevice(AudioDeviceBitfield device) override;
Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
setAndGetVolume_cb _hidl_cb) override;
Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
@@ -64,7 +66,7 @@ struct PresetReverbEffect : public IPresetReverbEffect {
Return<Result> setConfigReverse(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
Return<Result> setInputDevice(AudioDevice device) override;
Return<Result> setInputDevice(AudioDeviceBitfield device) override;
Return<void> getConfig(getConfig_cb _hidl_cb) override;
Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
Return<void> getSupportedAuxChannelsConfigs(

Some files were not shown because too many files have changed in this diff Show More