mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Merge "DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-master" into stage-aosp-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
26f1b51bfb
14
CleanSpec.mk
14
CleanSpec.mk
@@ -66,3 +66,17 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/vndk-sp/android.hardware
|
||||
$(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore\@1\.1*" -print0 | xargs -0 rm -f)
|
||||
$(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore*" -print0 | xargs -0 rm -f)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/seccomp_policy/configstore@1.0.policy)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/seccomp_policy/configstore@1.1.policy)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.configstore@1.1-service)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.configstore@1.1-service.rc)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.cas@1.0*)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.cas@1.0*)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/vintf/manifest/android.hardware.cas@1.0*)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.configstore@1.2-service.rc)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.configstore@1.2-service)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/seccomp_policy/configstore.policy)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/apex/com.android.media.swcodec/lib64/android.hardware.configstore@1.2.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/vndk-Q/android.hardware.configstore@1.2.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/android.hardware.configstore@1.2.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/vndk-Q/android.hardware.configstore@1.2.so)
|
||||
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/android.hardware.configstore@1.2.so)
|
||||
|
||||
@@ -169,6 +169,10 @@ interface IStreamIn extends IStream {
|
||||
/**
|
||||
* Specifies the logical microphone (for processing).
|
||||
*
|
||||
* If the feature is not supported an error should be returned
|
||||
* If multiple microphones are present, this should be treated as a preference
|
||||
* for their combined direction.
|
||||
*
|
||||
* Optional method
|
||||
*
|
||||
* @param Direction constant
|
||||
@@ -180,6 +184,10 @@ interface IStreamIn extends IStream {
|
||||
/**
|
||||
* Specifies the zoom factor for the selected microphone (for processing).
|
||||
*
|
||||
* If the feature is not supported an error should be returned
|
||||
* If multiple microphones are present, this should be treated as a preference
|
||||
* for their combined field dimension.
|
||||
*
|
||||
* Optional method
|
||||
*
|
||||
* @param the desired field dimension of microphone capture. Range is from -1 (wide angle),
|
||||
|
||||
@@ -20,8 +20,10 @@ package audio.policy.configuration.V5_0 {
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_COMMUNICATION;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_DEFAULT;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_DGTL_DOCK_HEADSET;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_ECHO_REFERENCE;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_FM_TUNER;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_HDMI;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_HDMI_ARC;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_IP;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_LINE;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioDevice AUDIO_DEVICE_IN_LOOPBACK;
|
||||
@@ -91,6 +93,10 @@ package audio.policy.configuration.V5_0 {
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_ERLC;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_HE_V1;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_HE_V2;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LATM;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LATM_HE_V1;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LATM_HE_V2;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LATM_LC;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LC;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LD;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AAC_LTP;
|
||||
@@ -106,7 +112,10 @@ package audio.policy.configuration.V5_0 {
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_AMR_WB_PLUS;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APE;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX_ADAPTIVE;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX_HD;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_APTX_TWSP;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_CELT;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_DOLBY_TRUEHD;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_DSD;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_DTS;
|
||||
@@ -122,6 +131,8 @@ package audio.policy.configuration.V5_0 {
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_HE_AAC_V2;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_IEC61937;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_LDAC;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_LHDC;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_LHDC_LL;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_MAT_1_0;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_MAT_2_0;
|
||||
enum_constant public static final audio.policy.configuration.V5_0.AudioFormat AUDIO_FORMAT_MAT_2_1;
|
||||
@@ -187,6 +198,7 @@ package audio.policy.configuration.V5_0 {
|
||||
public static class DevicePorts.DevicePort {
|
||||
ctor public DevicePorts.DevicePort();
|
||||
method public String getAddress();
|
||||
method public java.util.List<audio.policy.configuration.V5_0.AudioFormat> getEncodedFormats();
|
||||
method public audio.policy.configuration.V5_0.Gains getGains();
|
||||
method public java.util.List<audio.policy.configuration.V5_0.Profile> getProfile();
|
||||
method public audio.policy.configuration.V5_0.Role getRole();
|
||||
@@ -194,6 +206,7 @@ package audio.policy.configuration.V5_0 {
|
||||
method public String getType();
|
||||
method public boolean get_default();
|
||||
method public void setAddress(String);
|
||||
method public void setEncodedFormats(java.util.List<audio.policy.configuration.V5_0.AudioFormat>);
|
||||
method public void setGains(audio.policy.configuration.V5_0.Gains);
|
||||
method public void setRole(audio.policy.configuration.V5_0.Role);
|
||||
method public void setTagName(String);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<xs:element name="globalConfiguration" type="globalConfiguration"/>
|
||||
<xs:element name="modules" type="modules" maxOccurs="unbounded"/>
|
||||
<xs:element name="volumes" type="volumes" maxOccurs="unbounded"/>
|
||||
<xs:element name="surroundSound" type="surroundSound" />
|
||||
<xs:element name="surroundSound" type="surroundSound" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
<xs:attribute name="version" type="version"/>
|
||||
</xs:complexType>
|
||||
@@ -277,6 +277,8 @@
|
||||
<xs:enumeration value="AUDIO_DEVICE_IN_PROXY"/>
|
||||
<xs:enumeration value="AUDIO_DEVICE_IN_USB_HEADSET"/>
|
||||
<xs:enumeration value="AUDIO_DEVICE_IN_BLUETOOTH_BLE"/>
|
||||
<xs:enumeration value="AUDIO_DEVICE_IN_HDMI_ARC"/>
|
||||
<xs:enumeration value="AUDIO_DEVICE_IN_ECHO_REFERENCE"/>
|
||||
<xs:enumeration value="AUDIO_DEVICE_IN_DEFAULT"/>
|
||||
<xs:enumeration value="AUDIO_DEVICE_IN_STUB"/>
|
||||
</xs:restriction>
|
||||
@@ -364,6 +366,15 @@
|
||||
<xs:enumeration value="AUDIO_FORMAT_MAT_2_1"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_AAC_XHE"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_AAC_ADTS_XHE"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_AAC_LATM"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_AAC_LATM_LC"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_AAC_LATM_HE_V1"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_AAC_LATM_HE_V2"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_CELT"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_APTX_ADAPTIVE"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_LHDC"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_LHDC_LL"/>
|
||||
<xs:enumeration value="AUDIO_FORMAT_APTX_TWSP"/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:simpleType name="extendableAudioFormat">
|
||||
@@ -461,6 +472,8 @@
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="encodedFormats" type="audioFormatsList" use="optional"
|
||||
default="" />
|
||||
</xs:complexType>
|
||||
<xs:unique name="devicePortProfileUniqueness">
|
||||
<xs:selector xpath="profile"/>
|
||||
@@ -595,7 +608,7 @@
|
||||
<xs:element name="formats" type="surroundFormats"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:simpleType name="surroundFormatsList">
|
||||
<xs:simpleType name="audioFormatsList">
|
||||
<xs:list itemType="audioFormat" />
|
||||
</xs:simpleType>
|
||||
<xs:complexType name="surroundFormats">
|
||||
@@ -603,7 +616,7 @@
|
||||
<xs:element name="format" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="name" type="audioFormat" use="required"/>
|
||||
<xs:attribute name="subformats" type="surroundFormatsList" />
|
||||
<xs:attribute name="subformats" type="audioFormatsList" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
||||
49
audio/README
49
audio/README
@@ -1,48 +1,33 @@
|
||||
Directory structure of the audio HIDL related code.
|
||||
|
||||
audio
|
||||
|-- 2.0 <== HIDL (.hal) can not be moved to fit the directory structure
|
||||
| because that would create a separate HAL
|
||||
|-- 2.0 <== core 2.0 HIDL API. .hal can not be moved into the core directory
|
||||
| because that would change its namespace and include path
|
||||
|-- 4.0 <== Version 4.0 of the core API
|
||||
|
|
||||
|-- common <== code common to audio core and effect API
|
||||
| |-- 2.0
|
||||
| | |-- default <== code that wraps the legacy API
|
||||
| | `-- vts <== vts of 2.0 core and effect API common code
|
||||
| |-- 4.0
|
||||
| | |-- default
|
||||
| | `-- vts
|
||||
| |-- ... <== The future versions should continue this structure
|
||||
| | |-- default
|
||||
| | `-- vts
|
||||
| `-- all_versions <== code common to all version of both core and effect API
|
||||
| |-- default
|
||||
| `-- vts <== vts of core and effect API common version independent code
|
||||
|-- ...
|
||||
|
|
||||
|-- core <== code relative to the core API
|
||||
| |-- 2.0 <== 2.0 core API code (except .hal, see audio/2.0)
|
||||
| | |-- default
|
||||
| | `-- vts
|
||||
|-- common <== code common to audio core and effect API
|
||||
| |-- 2.0 <== HIDL API of V2
|
||||
| |-- 4.0
|
||||
| | |-- default <== default implementation of the core 4.0 api
|
||||
| | `-- vts <== vts code of the 4.0 API
|
||||
| |-- ...
|
||||
| | |-- default
|
||||
| | `-- vts
|
||||
| `-- all_versions
|
||||
| |-- default
|
||||
| `-- vts <== vts of core API common version independent code
|
||||
| `-- all_versions <== code common to all version of both core and effect API
|
||||
| |-- default <== implementation shared code between core and effect impl
|
||||
| |-- test <== utilities used by tests
|
||||
| `-- util <== utilities used by both implementation and tests
|
||||
|
|
||||
|-- core <== VTS and default implementation of the core API (not HIDL, see /audio/2.0))
|
||||
| `-- all_versions <== Code is version independent through #if and separate files
|
||||
| |-- default <== code that wraps the legacy API
|
||||
| `-- vts <== vts of core API
|
||||
| |-- 2.0 <== 2.0 specific tests and helpers
|
||||
| |-- 4.0
|
||||
| |-- ...
|
||||
|
|
||||
`-- effect <== idem for the effect API
|
||||
|-- 2.0
|
||||
| |-- default
|
||||
| `-- vts
|
||||
|-- 4.0
|
||||
| |-- default
|
||||
| `-- vts
|
||||
|-- ...
|
||||
| |-- default
|
||||
| `-- vts
|
||||
`-- all_versions
|
||||
|-- default
|
||||
`-- vts
|
||||
|
||||
@@ -146,6 +146,7 @@ enum AudioSource : int32_t {
|
||||
*/
|
||||
ECHO_REFERENCE = 1997,
|
||||
FM_TUNER = 1998,
|
||||
HOTWORD = 1999,
|
||||
};
|
||||
|
||||
typedef int32_t AudioSession;
|
||||
@@ -240,6 +241,7 @@ enum AudioFormat : uint32_t {
|
||||
APTX_ADAPTIVE = 0x27000000UL,
|
||||
LHDC = 0x28000000UL,
|
||||
LHDC_LL = 0x29000000UL,
|
||||
APTX_TWSP = 0x2A000000UL,
|
||||
|
||||
/** Deprecated */
|
||||
MAIN_MASK = 0xFF000000UL,
|
||||
@@ -329,7 +331,13 @@ enum FixedChannelCount : int32_t {
|
||||
|
||||
/**
|
||||
* A channel mask per se only defines the presence or absence of a channel, not
|
||||
* the order. See AUDIO_INTERLEAVE_* for the platform convention of order.
|
||||
* the order.
|
||||
*
|
||||
* The channel order convention is that channels are interleaved in order from
|
||||
* least significant channel mask bit to most significant channel mask bit,
|
||||
* with unused bits skipped. For example for stereo, LEFT would be first,
|
||||
* followed by RIGHT.
|
||||
* Any exceptions to this convention are noted at the appropriate API.
|
||||
*
|
||||
* AudioChannelMask is an opaque type and its internal layout should not be
|
||||
* assumed as it may change in the future. Instead, always use functions
|
||||
@@ -416,9 +424,9 @@ enum AudioChannelMask : uint32_t {
|
||||
OUT_2POINT1POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
|
||||
OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT |
|
||||
OUT_LOW_FREQUENCY),
|
||||
OUT_3POINT0POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT |
|
||||
OUT_3POINT0POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER |
|
||||
OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT),
|
||||
OUT_3POINT1POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_CENTER | OUT_FRONT_RIGHT |
|
||||
OUT_3POINT1POINT2 = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT | OUT_FRONT_CENTER |
|
||||
OUT_TOP_SIDE_LEFT | OUT_TOP_SIDE_RIGHT |
|
||||
OUT_LOW_FREQUENCY),
|
||||
OUT_QUAD = (OUT_FRONT_LEFT | OUT_FRONT_RIGHT |
|
||||
@@ -517,7 +525,23 @@ enum AudioChannelMask : uint32_t {
|
||||
INDEX_MASK_5 = INDEX_HDR | ((1 << 5) - 1),
|
||||
INDEX_MASK_6 = INDEX_HDR | ((1 << 6) - 1),
|
||||
INDEX_MASK_7 = INDEX_HDR | ((1 << 7) - 1),
|
||||
INDEX_MASK_8 = INDEX_HDR | ((1 << 8) - 1)
|
||||
INDEX_MASK_8 = INDEX_HDR | ((1 << 8) - 1),
|
||||
INDEX_MASK_9 = INDEX_HDR | ((1 << 9) - 1),
|
||||
INDEX_MASK_10 = INDEX_HDR | ((1 << 10) - 1),
|
||||
INDEX_MASK_11 = INDEX_HDR | ((1 << 11) - 1),
|
||||
INDEX_MASK_12 = INDEX_HDR | ((1 << 12) - 1),
|
||||
INDEX_MASK_13 = INDEX_HDR | ((1 << 13) - 1),
|
||||
INDEX_MASK_14 = INDEX_HDR | ((1 << 14) - 1),
|
||||
INDEX_MASK_15 = INDEX_HDR | ((1 << 15) - 1),
|
||||
INDEX_MASK_16 = INDEX_HDR | ((1 << 16) - 1),
|
||||
INDEX_MASK_17 = INDEX_HDR | ((1 << 17) - 1),
|
||||
INDEX_MASK_18 = INDEX_HDR | ((1 << 18) - 1),
|
||||
INDEX_MASK_19 = INDEX_HDR | ((1 << 19) - 1),
|
||||
INDEX_MASK_20 = INDEX_HDR | ((1 << 20) - 1),
|
||||
INDEX_MASK_21 = INDEX_HDR | ((1 << 21) - 1),
|
||||
INDEX_MASK_22 = INDEX_HDR | ((1 << 22) - 1),
|
||||
INDEX_MASK_23 = INDEX_HDR | ((1 << 23) - 1),
|
||||
INDEX_MASK_24 = INDEX_HDR | ((1 << 24) - 1),
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,9 +17,6 @@ cc_library_shared {
|
||||
name: "android.hardware.audio.common-util",
|
||||
defaults: ["hidl_defaults"],
|
||||
vendor_available: true,
|
||||
vndk: {
|
||||
enabled: true,
|
||||
},
|
||||
srcs: [
|
||||
"EffectMap.cpp",
|
||||
],
|
||||
@@ -41,3 +38,72 @@ cc_library_shared {
|
||||
"android.hardware.audio.common.util@all-versions",
|
||||
]
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "android.hardware.audio.common-util_default",
|
||||
defaults: ["hidl_defaults"],
|
||||
|
||||
vendor_available: true,
|
||||
srcs: [
|
||||
"HidlUtils.cpp",
|
||||
],
|
||||
|
||||
export_include_dirs: ["."],
|
||||
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libutils",
|
||||
"libhidlbase",
|
||||
"android.hardware.audio.common-util",
|
||||
],
|
||||
export_shared_lib_headers: [
|
||||
"android.hardware.audio.common-util"
|
||||
],
|
||||
|
||||
header_libs: [
|
||||
"libaudio_system_headers",
|
||||
"libhardware_headers",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio.common@2.0-util",
|
||||
defaults: ["android.hardware.audio.common-util_default"],
|
||||
|
||||
shared_libs: [
|
||||
"android.hardware.audio.common@2.0",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=2",
|
||||
"-DMINOR_VERSION=0",
|
||||
"-include common/all-versions/VersionMacro.h",
|
||||
]
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio.common@4.0-util",
|
||||
defaults: ["android.hardware.audio.common-util_default"],
|
||||
|
||||
shared_libs: [
|
||||
"android.hardware.audio.common@4.0",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=4",
|
||||
"-DMINOR_VERSION=0",
|
||||
"-include common/all-versions/VersionMacro.h",
|
||||
]
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio.common@5.0-util",
|
||||
defaults: ["android.hardware.audio.common-util_default"],
|
||||
|
||||
shared_libs: [
|
||||
"android.hardware.audio.common@5.0",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=5",
|
||||
"-DMINOR_VERSION=0",
|
||||
"-include common/all-versions/VersionMacro.h",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,36 +14,23 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef AUDIO_HAL_VERSION
|
||||
#error "AUDIO_HAL_VERSION must be set before including this file."
|
||||
#endif
|
||||
#include "HidlUtils.h"
|
||||
|
||||
#include <common/all-versions/VersionUtils.h>
|
||||
#include <string.h>
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGainMode;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMixLatencyClass;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfigMask;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortRole;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortType;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioStreamType;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioUsage;
|
||||
|
||||
using ::android::hardware::audio::common::utils::mkEnumConverter;
|
||||
using ::android::hardware::audio::common::utils::EnumBitfield;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace common {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
void HidlUtils::audioConfigFromHal(const audio_config_t& halConfig, AudioConfig* config) {
|
||||
config->sampleRateHz = halConfig.sample_rate;
|
||||
config->channelMask = mkEnumConverter<AudioChannelMask>(halConfig.channel_mask);
|
||||
config->channelMask = EnumBitfield<AudioChannelMask>(halConfig.channel_mask);
|
||||
config->format = AudioFormat(halConfig.format);
|
||||
audioOffloadInfoFromHal(halConfig.offload_info, &config->offloadInfo);
|
||||
config->frameCount = halConfig.frame_count;
|
||||
@@ -61,8 +48,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 = mkEnumConverter<AudioGainMode>(halConfig.mode);
|
||||
config->channelMask = mkEnumConverter<AudioChannelMask>(halConfig.channel_mask);
|
||||
config->mode = EnumBitfield<AudioGainMode>(halConfig.mode);
|
||||
config->channelMask = EnumBitfield<AudioChannelMask>(halConfig.channel_mask);
|
||||
for (size_t i = 0; i < sizeof(audio_channel_mask_t) * 8; ++i) {
|
||||
config->values[i] = halConfig.values[i];
|
||||
}
|
||||
@@ -82,8 +69,8 @@ void HidlUtils::audioGainConfigToHal(const AudioGainConfig& config,
|
||||
}
|
||||
|
||||
void HidlUtils::audioGainFromHal(const struct audio_gain& halGain, AudioGain* gain) {
|
||||
gain->mode = mkEnumConverter<AudioGainMode>(halGain.mode);
|
||||
gain->channelMask = mkEnumConverter<AudioChannelMask>(halGain.channel_mask);
|
||||
gain->mode = EnumBitfield<AudioGainMode>(halGain.mode);
|
||||
gain->channelMask = EnumBitfield<AudioChannelMask>(halGain.channel_mask);
|
||||
gain->minValue = halGain.min_value;
|
||||
gain->maxValue = halGain.max_value;
|
||||
gain->defaultValue = halGain.default_value;
|
||||
@@ -122,7 +109,7 @@ audio_usage_t HidlUtils::audioUsageToHal(const AudioUsage usage) {
|
||||
void HidlUtils::audioOffloadInfoFromHal(const audio_offload_info_t& halOffload,
|
||||
AudioOffloadInfo* offload) {
|
||||
offload->sampleRateHz = halOffload.sample_rate;
|
||||
offload->channelMask = mkEnumConverter<AudioChannelMask>(halOffload.channel_mask);
|
||||
offload->channelMask = EnumBitfield<AudioChannelMask>(halOffload.channel_mask);
|
||||
offload->format = AudioFormat(halOffload.format);
|
||||
offload->streamType = AudioStreamType(halOffload.stream_type);
|
||||
offload->bitRatePerSecond = halOffload.bit_rate;
|
||||
@@ -155,9 +142,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 = mkEnumConverter<AudioPortConfigMask>(halConfig.config_mask);
|
||||
config->configMask = EnumBitfield<AudioPortConfigMask>(halConfig.config_mask);
|
||||
config->sampleRateHz = halConfig.sample_rate;
|
||||
config->channelMask = mkEnumConverter<AudioChannelMask>(halConfig.channel_mask);
|
||||
config->channelMask = EnumBitfield<AudioChannelMask>(halConfig.channel_mask);
|
||||
config->format = AudioFormat(halConfig.format);
|
||||
audioGainConfigFromHal(halConfig.gain, &config->gain);
|
||||
switch (halConfig.type) {
|
||||
@@ -174,9 +161,9 @@ void HidlUtils::audioPortConfigFromHal(const struct audio_port_config& halConfig
|
||||
config->ext.mix.hwModule = halConfig.ext.mix.hw_module;
|
||||
config->ext.mix.ioHandle = halConfig.ext.mix.handle;
|
||||
if (halConfig.role == AUDIO_PORT_ROLE_SOURCE) {
|
||||
config->ext.mix.useCase.source = AudioSource(halConfig.ext.mix.usecase.source);
|
||||
} else if (halConfig.role == AUDIO_PORT_ROLE_SINK) {
|
||||
config->ext.mix.useCase.stream = AudioStreamType(halConfig.ext.mix.usecase.stream);
|
||||
} else if (halConfig.role == AUDIO_PORT_ROLE_SINK) {
|
||||
config->ext.mix.useCase.source = AudioSource(halConfig.ext.mix.usecase.source);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -212,11 +199,11 @@ void HidlUtils::audioPortConfigToHal(const AudioPortConfig& config,
|
||||
halConfig->ext.mix.hw_module = config.ext.mix.hwModule;
|
||||
halConfig->ext.mix.handle = config.ext.mix.ioHandle;
|
||||
if (config.role == AudioPortRole::SOURCE) {
|
||||
halConfig->ext.mix.usecase.source =
|
||||
static_cast<audio_source_t>(config.ext.mix.useCase.source);
|
||||
} else if (config.role == AudioPortRole::SINK) {
|
||||
halConfig->ext.mix.usecase.stream =
|
||||
static_cast<audio_stream_type_t>(config.ext.mix.useCase.stream);
|
||||
} else if (config.role == AudioPortRole::SINK) {
|
||||
halConfig->ext.mix.usecase.source =
|
||||
static_cast<audio_source_t>(config.ext.mix.useCase.source);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -257,7 +244,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] = mkEnumConverter<AudioChannelMask>(halPort.channel_masks[i]);
|
||||
port->channelMasks[i] = EnumBitfield<AudioChannelMask>(halPort.channel_masks[i]);
|
||||
}
|
||||
port->formats.resize(halPort.num_formats);
|
||||
for (size_t i = 0; i < halPort.num_formats; ++i) {
|
||||
@@ -358,7 +345,8 @@ void HidlUtils::uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid) {
|
||||
memcpy(halUuid->node, uuid.node.data(), uuid.node.size());
|
||||
}
|
||||
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace implementation
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace common
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,28 +14,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef AUDIO_HAL_VERSION
|
||||
#error "AUDIO_HAL_VERSION must be set before including this file."
|
||||
#endif
|
||||
#ifndef android_hardware_audio_Hidl_Utils_H_
|
||||
#define android_hardware_audio_Hidl_Utils_H_
|
||||
|
||||
#include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <system/audio.h>
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGain;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGainConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOffloadInfo;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid;
|
||||
using ::android::hardware::hidl_vec;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace common {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
|
||||
class HidlUtils {
|
||||
public:
|
||||
@@ -68,8 +65,11 @@ class HidlUtils {
|
||||
static void uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid);
|
||||
};
|
||||
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace implementation
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace common
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // android_hardware_audio_Hidl_Utils_H_
|
||||
@@ -17,22 +17,29 @@
|
||||
#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>
|
||||
#include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace common {
|
||||
namespace V4_0 {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
typedef hidl_bitfield<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;
|
||||
#if MAJOR_VERSION == 2
|
||||
typedef common::CPP_VERSION::AudioDevice AudioDeviceBitfield;
|
||||
typedef common::CPP_VERSION::AudioChannelMask AudioChannelBitfield;
|
||||
typedef common::CPP_VERSION::AudioOutputFlag AudioOutputFlagBitfield;
|
||||
typedef common::CPP_VERSION::AudioInputFlag AudioInputFlagBitfield;
|
||||
#elif MAJOR_VERSION >= 4
|
||||
typedef hidl_bitfield<common::CPP_VERSION::AudioDevice> AudioDeviceBitfield;
|
||||
typedef hidl_bitfield<common::CPP_VERSION::AudioChannelMask> AudioChannelBitfield;
|
||||
typedef hidl_bitfield<common::CPP_VERSION::AudioOutputFlag> AudioOutputFlagBitfield;
|
||||
typedef hidl_bitfield<common::CPP_VERSION::AudioInputFlag> AudioInputFlagBitfield;
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V4_0
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace common
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -31,22 +31,28 @@ LOCAL_SRC_FILES := \
|
||||
LOCAL_CFLAGS := -Wall -Werror
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libcutils \
|
||||
libbinder \
|
||||
libhidlbase \
|
||||
libhidltransport \
|
||||
liblog \
|
||||
libutils \
|
||||
libhardware \
|
||||
libhwbinder \
|
||||
android.hardware.audio@2.0 \
|
||||
android.hardware.audio@4.0 \
|
||||
android.hardware.audio@5.0 \
|
||||
android.hardware.audio.common@2.0 \
|
||||
android.hardware.audio.common@4.0 \
|
||||
android.hardware.audio.common@5.0 \
|
||||
android.hardware.audio.effect@2.0 \
|
||||
android.hardware.audio.effect@4.0 \
|
||||
android.hardware.audio.effect@5.0 \
|
||||
android.hardware.bluetooth.a2dp@1.0 \
|
||||
android.hardware.bluetooth.audio@2.0 \
|
||||
android.hardware.soundtrigger@2.0 \
|
||||
android.hardware.soundtrigger@2.1
|
||||
android.hardware.soundtrigger@2.1 \
|
||||
android.hardware.soundtrigger@2.2
|
||||
|
||||
# Can not switch to Android.bp until AUDIOSERVER_MULTILIB
|
||||
# is deprecated as build config variable are not supported
|
||||
|
||||
@@ -18,36 +18,52 @@
|
||||
|
||||
#include <android/hardware/audio/2.0/IDevicesFactory.h>
|
||||
#include <android/hardware/audio/4.0/IDevicesFactory.h>
|
||||
#include <android/hardware/audio/5.0/IDevicesFactory.h>
|
||||
#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
|
||||
#include <android/hardware/audio/effect/4.0/IEffectsFactory.h>
|
||||
#include <android/hardware/audio/effect/5.0/IEffectsFactory.h>
|
||||
#include <android/hardware/bluetooth/a2dp/1.0/IBluetoothAudioOffload.h>
|
||||
#include <android/hardware/bluetooth/audio/2.0/IBluetoothAudioProvidersFactory.h>
|
||||
#include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
|
||||
#include <android/hardware/soundtrigger/2.1/ISoundTriggerHw.h>
|
||||
#include <android/hardware/soundtrigger/2.2/ISoundTriggerHw.h>
|
||||
#include <binder/ProcessState.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#include <hidl/LegacySupport.h>
|
||||
#include <hwbinder/ProcessState.h>
|
||||
|
||||
using namespace android::hardware;
|
||||
using android::OK;
|
||||
|
||||
int main(int /* argc */, char* /* argv */ []) {
|
||||
android::ProcessState::initWithDriver("/dev/vndbinder");
|
||||
::android::ProcessState::initWithDriver("/dev/vndbinder");
|
||||
// start a threadpool for vndbinder interactions
|
||||
android::ProcessState::self()->startThreadPool();
|
||||
::android::ProcessState::self()->startThreadPool();
|
||||
|
||||
const int32_t defaultValue = -1;
|
||||
int32_t value =
|
||||
property_get_int32("persist.vendor.audio.service.hwbinder.size_kbyte", defaultValue);
|
||||
if (value != defaultValue) {
|
||||
ALOGD("Configuring hwbinder with mmap size %d KBytes", value);
|
||||
ProcessState::initWithMmapSize(static_cast<size_t>(value) * 1024);
|
||||
}
|
||||
configureRpcThreadpool(16, true /*callerWillJoin*/);
|
||||
|
||||
bool fail = registerPassthroughServiceImplementation<audio::V4_0::IDevicesFactory>() != OK &&
|
||||
bool fail = registerPassthroughServiceImplementation<audio::V5_0::IDevicesFactory>() != OK &&
|
||||
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");
|
||||
LOG_ALWAYS_FATAL_IF(fail, "Could not register audio core API 2, 4 nor 5");
|
||||
|
||||
fail = registerPassthroughServiceImplementation<audio::effect::V4_0::IEffectsFactory>() != OK &&
|
||||
fail = registerPassthroughServiceImplementation<audio::effect::V5_0::IEffectsFactory>() != OK &&
|
||||
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");
|
||||
LOG_ALWAYS_FATAL_IF(fail, "Could not register audio effect API 2, 4 nor 5");
|
||||
|
||||
fail = registerPassthroughServiceImplementation<soundtrigger::V2_1::ISoundTriggerHw>() != OK &&
|
||||
fail = registerPassthroughServiceImplementation<soundtrigger::V2_2::ISoundTriggerHw>() != OK &&
|
||||
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");
|
||||
ALOGW_IF(fail, "Could not register soundtrigger API 2.0, 2.1 nor 2.2");
|
||||
|
||||
fail = registerPassthroughServiceImplementation<
|
||||
bluetooth::audio::V2_0::IBluetoothAudioProvidersFactory>() != OK;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,10 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef AUDIO_HAL_VERSION
|
||||
#error "AUDIO_HAL_VERSION must be set before including this file."
|
||||
#endif
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_COMMON_TEST_UTILITY_PRETTY_PRINT_AUDIO_TYPES_H
|
||||
#define ANDROID_HARDWARE_AUDIO_COMMON_TEST_UTILITY_PRETTY_PRINT_AUDIO_TYPES_H
|
||||
|
||||
@@ -40,19 +36,19 @@ namespace audio {
|
||||
#define DEFINE_GTEST_PRINT_TO(T) \
|
||||
inline void PrintTo(const T& val, ::std::ostream* os) { *os << toString(val); }
|
||||
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
DEFINE_GTEST_PRINT_TO(IPrimaryDevice::TtyMode)
|
||||
DEFINE_GTEST_PRINT_TO(Result)
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
|
||||
namespace common {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
DEFINE_GTEST_PRINT_TO(AudioConfig)
|
||||
DEFINE_GTEST_PRINT_TO(AudioMode)
|
||||
DEFINE_GTEST_PRINT_TO(AudioDevice)
|
||||
DEFINE_GTEST_PRINT_TO(AudioFormat)
|
||||
DEFINE_GTEST_PRINT_TO(AudioChannelMask)
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace common
|
||||
|
||||
#undef DEFINE_GTEST_PRINT_TO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -162,8 +162,8 @@ template <bool atLeastOneRequired>
|
||||
<< "\n Which is: " << xmlFileName
|
||||
<< "\n In the following folders: " << xmlFileLocationsExpr
|
||||
<< "\n Which is: " << ::testing::PrintToString(xmlFileLocations)
|
||||
<< (atLeastOneRequired ? "Where at least one file must be found."
|
||||
: "Where no file might exist.");
|
||||
<< (atLeastOneRequired ? "\nWhere at least one file must be found."
|
||||
: "\nWhere no file might exist.");
|
||||
}
|
||||
|
||||
template ::testing::AssertionResult validateXmlMultipleLocations<true>(const char*, const char*,
|
||||
|
||||
@@ -2,9 +2,6 @@ cc_library_headers {
|
||||
name: "android.hardware.audio.common.util@all-versions",
|
||||
defaults: ["hidl_defaults"],
|
||||
vendor_available: true,
|
||||
vndk: {
|
||||
enabled: true,
|
||||
},
|
||||
|
||||
export_include_dirs: ["include"],
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,15 +14,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H
|
||||
#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H
|
||||
#ifndef android_hardware_audio_common_HidlSupport_H_
|
||||
#define android_hardware_audio_common_HidlSupport_H_
|
||||
|
||||
#include <android/hardware/audio/effect/2.0/IVisualizerEffect.h>
|
||||
|
||||
#include "Effect.h"
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <algorithm>
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/VisualizerEffect.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
namespace android::hardware::audio::common::utils {
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H
|
||||
template <typename Enum>
|
||||
bool isValidHidlEnum(Enum e) {
|
||||
hidl_enum_range<Enum> values;
|
||||
return std::find(values.begin(), values.end(), e) != values.end();
|
||||
}
|
||||
|
||||
} // namespace android::hardware::audio::common::utils
|
||||
|
||||
#endif // android_hardware_audio_common_HidlSupport_H_
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef AUDIO_HAL_VERSION
|
||||
#error "AUDIO_HAL_VERSION must be set before including this file."
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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_VERSION_MACRO_H
|
||||
#define ANDROID_HARDWARE_VERSION_MACRO_H
|
||||
|
||||
#if !defined(MAJOR_VERSION) || !defined(MINOR_VERSION)
|
||||
#error "MAJOR_VERSION and MINOR_VERSION must be defined"
|
||||
#endif
|
||||
|
||||
/** Allows macro expansion for x and add surrounding `<>`.
|
||||
* Is intended to be used for version dependant includes as
|
||||
* `#include` do not macro expand if starting with < or "
|
||||
* Example usage:
|
||||
* #include PATH(path/to/FILE_VERSION/file)
|
||||
* @note: uses the implementation-define "Computed Includes" feature.
|
||||
*/
|
||||
#define PATH(x) <x>
|
||||
|
||||
#define CONCAT_3(a, b, c) a##b##c
|
||||
#define EXPAND_CONCAT_3(a, b, c) CONCAT_3(a, b, c)
|
||||
/** The directory name of the version: <major>.<minor> */
|
||||
#define FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., MINOR_VERSION)
|
||||
|
||||
#define CONCAT_4(a, b, c, d) a##b##c##d
|
||||
#define EXPAND_CONCAT_4(a, b, c, d) CONCAT_4(a, b, c, d)
|
||||
/** The c++ namespace of the version: V<major>_<minor> */
|
||||
#define CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, MINOR_VERSION)
|
||||
|
||||
#endif // ANDROID_HARDWARE_VERSION_MACRO_H
|
||||
@@ -26,36 +26,31 @@ 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 {
|
||||
/** Converting between a bitfield or itself. */
|
||||
template <class Enum>
|
||||
class EnumBitfield {
|
||||
public:
|
||||
static_assert(std::is_enum<Source>::value || std::is_enum<Destination>::value,
|
||||
"Source or destination should be an enum");
|
||||
using Bitfield = ::android::hardware::hidl_bitfield<Enum>;
|
||||
|
||||
explicit EnumConverter(Source source) : mSource(source) {}
|
||||
EnumBitfield(const EnumBitfield&) = default;
|
||||
explicit EnumBitfield(Enum value) : mValue(value) {}
|
||||
explicit EnumBitfield(Bitfield value) : EnumBitfield(static_cast<Enum>(value)) {}
|
||||
|
||||
operator Destination() const { return static_cast<Destination>(mSource); }
|
||||
EnumBitfield& operator=(const EnumBitfield&) = default;
|
||||
EnumBitfield& operator=(Enum value) { return *this = EnumBitfield{value}; }
|
||||
EnumBitfield& operator=(Bitfield value) { return *this = EnumBitfield{value}; }
|
||||
|
||||
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);
|
||||
}
|
||||
operator Enum() const { return mValue; }
|
||||
operator Bitfield() const { return static_cast<Bitfield>(mValue); }
|
||||
|
||||
private:
|
||||
const Source mSource;
|
||||
Enum mValue;
|
||||
};
|
||||
template <class Destination, class Source>
|
||||
auto mkEnumConverter(Source source) {
|
||||
return EnumConverter<Source, Destination>{source};
|
||||
}
|
||||
|
||||
/** Allows converting an enum to its bitfield or itself. */
|
||||
/** ATD way to create a EnumBitfield. */
|
||||
template <class Enum>
|
||||
EnumConverter<Enum> mkBitfield(Enum value) {
|
||||
return EnumConverter<Enum>{value};
|
||||
EnumBitfield<Enum> mkEnumBitfield(Enum value) {
|
||||
return EnumBitfield<Enum>{value};
|
||||
}
|
||||
|
||||
} // namespace utils
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio@2.0-impl",
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"Conversions.cpp",
|
||||
"Device.cpp",
|
||||
"DevicesFactory.cpp",
|
||||
"ParametersUtil.cpp",
|
||||
"PrimaryDevice.cpp",
|
||||
"Stream.cpp",
|
||||
"StreamIn.cpp",
|
||||
"StreamOut.cpp",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-DAUDIO_HAL_VERSION_2_0",
|
||||
],
|
||||
|
||||
defaults: ["hidl_defaults"],
|
||||
|
||||
export_include_dirs: ["include"],
|
||||
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libfmq",
|
||||
"libhardware",
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"android.hardware.audio@2.0",
|
||||
"android.hardware.audio.common@2.0",
|
||||
"android.hardware.audio.common@2.0-util",
|
||||
"android.hardware.audio.common-util",
|
||||
],
|
||||
|
||||
header_libs: [
|
||||
"android.hardware.audio.common.util@all-versions",
|
||||
"android.hardware.audio.core@all-versions-impl",
|
||||
"libaudioclient_headers",
|
||||
"libaudio_system_headers",
|
||||
"libhardware_headers",
|
||||
"libmedia_headers",
|
||||
],
|
||||
|
||||
whole_static_libs: [
|
||||
"libmedia_helper",
|
||||
],
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "core/2.0/default/Conversions.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/Conversions.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "core/2.0/default/ParametersUtil.h"
|
||||
#include "core/2.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/ParametersUtil.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "PrimaryDeviceHAL"
|
||||
|
||||
#include "core/2.0/default/PrimaryDevice.h"
|
||||
#include "core/2.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/PrimaryDevice.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "StreamHAL"
|
||||
|
||||
#include "core/2.0/default/Stream.h"
|
||||
#include "common/all-versions/default/EffectMap.h"
|
||||
#include "core/2.0/default/Conversions.h"
|
||||
#include "core/2.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/Stream.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "StreamInHAL"
|
||||
|
||||
#include "core/2.0/default/StreamIn.h"
|
||||
#include "core/2.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/StreamIn.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "StreamOutHAL"
|
||||
|
||||
#include "core/2.0/default/StreamOut.h"
|
||||
#include "core/2.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/StreamOut.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
|
||||
|
||||
#include <android/hardware/audio/2.0/IDevicesFactory.h>
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/DevicesFactory.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_
|
||||
#define ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_
|
||||
|
||||
#include <android/hardware/audio/2.0/types.h>
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/ParametersUtil.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
|
||||
|
||||
#include <android/hardware/audio/2.0/IPrimaryDevice.h>
|
||||
|
||||
#include "Device.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/PrimaryDevice.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
|
||||
|
||||
#include <android/hardware/audio/2.0/IStream.h>
|
||||
|
||||
#include "ParametersUtil.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/Stream.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
|
||||
|
||||
#include <android/hardware/audio/2.0/IStreamIn.h>
|
||||
|
||||
#include "Device.h"
|
||||
#include "Stream.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/StreamIn.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
|
||||
|
||||
#include <android/hardware/audio/2.0/IStreamOut.h>
|
||||
|
||||
#include "Device.h"
|
||||
#include "Stream.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <core/all-versions/default/StreamOut.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
|
||||
#include "utility/ValidateXml.h"
|
||||
|
||||
TEST(CheckConfig, audioPolicyConfigurationValidation) {
|
||||
RecordProperty("description",
|
||||
"Verify that the audio policy configuration file "
|
||||
"is valid according to the schema");
|
||||
|
||||
std::vector<const char*> locations = {"/odm/etc", "/vendor/etc", "/system/etc"};
|
||||
EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("audio_policy_configuration.xml", locations,
|
||||
"/data/local/tmp/audio_policy_configuration.xsd");
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio@4.0-impl",
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"Conversions.cpp",
|
||||
"Device.cpp",
|
||||
"DevicesFactory.cpp",
|
||||
"ParametersUtil.cpp",
|
||||
"PrimaryDevice.cpp",
|
||||
"Stream.cpp",
|
||||
"StreamIn.cpp",
|
||||
"StreamOut.cpp",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-DAUDIO_HAL_VERSION_4_0",
|
||||
],
|
||||
|
||||
defaults: ["hidl_defaults"],
|
||||
|
||||
export_include_dirs: ["include"],
|
||||
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libfmq",
|
||||
"libhardware",
|
||||
"libhidlbase",
|
||||
"libhidltransport",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"android.hardware.audio@4.0",
|
||||
"android.hardware.audio.common@4.0",
|
||||
"android.hardware.audio.common@4.0-util",
|
||||
"android.hardware.audio.common-util",
|
||||
],
|
||||
|
||||
header_libs: [
|
||||
"android.hardware.audio.common.util@all-versions",
|
||||
"android.hardware.audio.core@all-versions-impl",
|
||||
"libaudioclient_headers",
|
||||
"libaudio_system_headers",
|
||||
"libhardware_headers",
|
||||
"libmedia_headers",
|
||||
],
|
||||
|
||||
whole_static_libs: [
|
||||
"libmedia_helper",
|
||||
],
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "core/4.0/default/Conversions.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/Conversions.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "DeviceHAL"
|
||||
|
||||
#include "core/4.0/default/Device.h"
|
||||
#include <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/4.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/Device.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "DevicesFactoryHAL"
|
||||
|
||||
#include "core/4.0/default/DevicesFactory.h"
|
||||
#include "core/4.0/default/Device.h"
|
||||
#include "core/4.0/default/PrimaryDevice.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/DevicesFactory.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,3 +0,0 @@
|
||||
elaurent@google.com
|
||||
krocard@google.com
|
||||
mnaganov@google.com
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "core/4.0/default/ParametersUtil.h"
|
||||
#include "core/4.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/ParametersUtil.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "PrimaryDeviceHAL"
|
||||
|
||||
#include "core/4.0/default/PrimaryDevice.h"
|
||||
#include "core/4.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/PrimaryDevice.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "StreamHAL"
|
||||
|
||||
#include "core/4.0/default/Stream.h"
|
||||
#include "common/all-versions/default/EffectMap.h"
|
||||
#include "core/4.0/default/Conversions.h"
|
||||
#include "core/4.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/Stream.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "StreamInHAL"
|
||||
|
||||
#include "core/4.0/default/StreamIn.h"
|
||||
#include "core/4.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/StreamIn.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "StreamOutHAL"
|
||||
|
||||
#include "core/4.0/default/StreamOut.h"
|
||||
#include "core/4.0/default/Util.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V4_0
|
||||
#include <core/all-versions/default/StreamOut.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_CONVERSIONS_H_
|
||||
|
||||
#include <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_
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_DEVICE_H
|
||||
|
||||
#include <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
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_DEVICESFACTORY_H
|
||||
|
||||
#include <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
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_PARAMETERS_UTIL_H_
|
||||
|
||||
#include <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_
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_PRIMARYDEVICE_H
|
||||
|
||||
#include <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
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_STREAM_H
|
||||
|
||||
#include <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
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_STREAMIN_H
|
||||
|
||||
#include <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
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H
|
||||
#define ANDROID_HARDWARE_AUDIO_V4_0_STREAMOUT_H
|
||||
|
||||
#include <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
|
||||
@@ -1,5 +0,0 @@
|
||||
elaurent@google.com
|
||||
krocard@google.com
|
||||
mnaganov@google.com
|
||||
yim@google.com
|
||||
zhuoyao@google.com
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
|
||||
#include "utility/ValidateXml.h"
|
||||
|
||||
TEST(CheckConfig, audioPolicyConfigurationValidation) {
|
||||
RecordProperty("description",
|
||||
"Verify that the audio policy configuration file "
|
||||
"is valid according to the schema");
|
||||
|
||||
std::vector<const char*> locations = {"/odm/etc", "/vendor/etc", "/system/etc"};
|
||||
EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("audio_policy_configuration.xml", locations,
|
||||
"/data/local/tmp/audio_policy_configuration_V4_0.xsd");
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
elaurent@google.com
|
||||
krocard@google.com
|
||||
mnaganov@google.com
|
||||
@@ -1,7 +1,18 @@
|
||||
cc_library_headers {
|
||||
name: "android.hardware.audio.core@all-versions-impl",
|
||||
cc_defaults {
|
||||
name: "android.hardware.audio-impl_default",
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"Conversions.cpp",
|
||||
"Device.cpp",
|
||||
"DevicesFactory.cpp",
|
||||
"ParametersUtil.cpp",
|
||||
"PrimaryDevice.cpp",
|
||||
"Stream.cpp",
|
||||
"StreamIn.cpp",
|
||||
"StreamOut.cpp",
|
||||
],
|
||||
|
||||
defaults: ["hidl_defaults"],
|
||||
|
||||
@@ -20,10 +31,65 @@ cc_library_headers {
|
||||
],
|
||||
|
||||
header_libs: [
|
||||
"android.hardware.audio.common.util@all-versions",
|
||||
"libaudioclient_headers",
|
||||
"libaudio_system_headers",
|
||||
"libhardware_headers",
|
||||
"libmedia_headers",
|
||||
"android.hardware.audio.common.util@all-versions",
|
||||
],
|
||||
|
||||
whole_static_libs: [
|
||||
"libmedia_helper",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio@2.0-impl",
|
||||
defaults: ["android.hardware.audio-impl_default"],
|
||||
|
||||
shared_libs: [
|
||||
"android.hardware.audio@2.0",
|
||||
"android.hardware.audio.common@2.0",
|
||||
"android.hardware.audio.common@2.0-util",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=2",
|
||||
"-DMINOR_VERSION=0",
|
||||
"-include common/all-versions/VersionMacro.h",
|
||||
]
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio@4.0-impl",
|
||||
defaults: ["android.hardware.audio-impl_default"],
|
||||
|
||||
shared_libs: [
|
||||
"android.hardware.audio@4.0",
|
||||
"android.hardware.audio.common@4.0",
|
||||
"android.hardware.audio.common@4.0-util",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=4",
|
||||
"-DMINOR_VERSION=0",
|
||||
"-include common/all-versions/VersionMacro.h",
|
||||
]
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio@5.0-impl",
|
||||
defaults: ["android.hardware.audio-impl_default"],
|
||||
|
||||
shared_libs: [
|
||||
"android.hardware.audio@5.0",
|
||||
"android.hardware.audio.common@5.0",
|
||||
"android.hardware.audio.common@5.0-util",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=5",
|
||||
"-DMINOR_VERSION=0",
|
||||
"-include common/all-versions/VersionMacro.h",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#include "core/default/Conversions.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -23,11 +23,9 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
|
||||
|
||||
std::string deviceAddressToHal(const DeviceAddress& address) {
|
||||
// HAL assumes that the address is NUL-terminated.
|
||||
char halAddress[AUDIO_DEVICE_MAX_ADDRESS_LEN];
|
||||
@@ -58,7 +56,7 @@ std::string deviceAddressToHal(const DeviceAddress& address) {
|
||||
return halAddress;
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#if MAJOR_VERSION >= 4
|
||||
status_t deviceAddressFromHal(audio_devices_t device, const char* halAddress,
|
||||
DeviceAddress* address) {
|
||||
if (address == nullptr) {
|
||||
@@ -188,7 +186,7 @@ bool halToMicrophoneCharacteristics(MicrophoneInfo* pDst,
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#define LOG_TAG "DeviceHAL"
|
||||
|
||||
#include "core/default/Device.h"
|
||||
#include <HidlUtils.h>
|
||||
#include "core/default/Conversions.h"
|
||||
#include "core/default/StreamIn.h"
|
||||
#include "core/default/StreamOut.h"
|
||||
#include "core/default/Util.h"
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
|
||||
@@ -24,14 +31,14 @@
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils;
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::common::CPP_VERSION::implementation::HidlUtils;
|
||||
|
||||
Device::Device(audio_hw_device_t* device) : mDevice(device) {}
|
||||
|
||||
Device::~Device() {
|
||||
@@ -40,8 +47,9 @@ Device::~Device() {
|
||||
mDevice = nullptr;
|
||||
}
|
||||
|
||||
Result Device::analyzeStatus(const char* funcName, int status) {
|
||||
return util::analyzeStatus("Device", funcName, status);
|
||||
Result Device::analyzeStatus(const char* funcName, int status,
|
||||
const std::vector<int>& ignoreErrors) {
|
||||
return util::analyzeStatus("Device", funcName, status, ignoreErrors);
|
||||
}
|
||||
|
||||
void Device::closeInputStream(audio_stream_in_t* stream) {
|
||||
@@ -60,7 +68,7 @@ int Device::halSetParameters(const char* keysAndValues) {
|
||||
return mDevice->set_parameters(mDevice, keysAndValues);
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow.
|
||||
Return<Result> Device::initCheck() {
|
||||
return analyzeStatus("init_check", mDevice->init_check(mDevice));
|
||||
}
|
||||
@@ -129,12 +137,11 @@ Return<void> Device::getInputBufferSize(const AudioConfig& config, getInputBuffe
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
const SourceMetadata& /* sourceMetadata */,
|
||||
#endif
|
||||
openOutputStream_cb _hidl_cb) {
|
||||
std::tuple<Result, sp<IStreamOut>> Device::openOutputStreamImpl(int32_t ioHandle,
|
||||
const DeviceAddress& device,
|
||||
const AudioConfig& config,
|
||||
AudioOutputFlagBitfield flags,
|
||||
AudioConfig* suggestedConfig) {
|
||||
audio_config_t halConfig;
|
||||
HidlUtils::audioConfigToHal(config, &halConfig);
|
||||
audio_stream_out_t* halStream;
|
||||
@@ -153,15 +160,13 @@ Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& dev
|
||||
if (status == OK) {
|
||||
streamOut = new StreamOut(this, halStream);
|
||||
}
|
||||
AudioConfig suggestedConfig;
|
||||
HidlUtils::audioConfigFromHal(halConfig, &suggestedConfig);
|
||||
_hidl_cb(analyzeStatus("open_output_stream", status), streamOut, suggestedConfig);
|
||||
return Void();
|
||||
HidlUtils::audioConfigFromHal(halConfig, suggestedConfig);
|
||||
return {analyzeStatus("open_output_stream", status, {EINVAL} /*ignore*/), streamOut};
|
||||
}
|
||||
|
||||
Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb) {
|
||||
std::tuple<Result, sp<IStreamIn>> Device::openInputStreamImpl(
|
||||
int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config,
|
||||
AudioInputFlagBitfield flags, AudioSource source, AudioConfig* suggestedConfig) {
|
||||
audio_config_t halConfig;
|
||||
HidlUtils::audioConfigToHal(config, &halConfig);
|
||||
audio_stream_in_t* halStream;
|
||||
@@ -181,13 +186,46 @@ Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& devi
|
||||
if (status == OK) {
|
||||
streamIn = new StreamIn(this, halStream);
|
||||
}
|
||||
HidlUtils::audioConfigFromHal(halConfig, suggestedConfig);
|
||||
return {analyzeStatus("open_input_stream", status, {EINVAL} /*ignore*/), streamIn};
|
||||
}
|
||||
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
openOutputStream_cb _hidl_cb) {
|
||||
AudioConfig suggestedConfig;
|
||||
HidlUtils::audioConfigFromHal(halConfig, &suggestedConfig);
|
||||
_hidl_cb(analyzeStatus("open_input_stream", status), streamIn, suggestedConfig);
|
||||
auto [result, streamOut] =
|
||||
openOutputStreamImpl(ioHandle, device, config, flags, &suggestedConfig);
|
||||
_hidl_cb(result, streamOut, suggestedConfig);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb) {
|
||||
AudioConfig suggestedConfig;
|
||||
auto [result, streamIn] =
|
||||
openInputStreamImpl(ioHandle, device, config, flags, source, &suggestedConfig);
|
||||
_hidl_cb(result, streamIn, suggestedConfig);
|
||||
return Void();
|
||||
}
|
||||
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
const SourceMetadata& sourceMetadata,
|
||||
openOutputStream_cb _hidl_cb) {
|
||||
AudioConfig suggestedConfig;
|
||||
auto [result, streamOut] =
|
||||
openOutputStreamImpl(ioHandle, device, config, flags, &suggestedConfig);
|
||||
if (streamOut) {
|
||||
streamOut->updateSourceMetadata(sourceMetadata);
|
||||
}
|
||||
_hidl_cb(result, streamOut, suggestedConfig);
|
||||
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,
|
||||
@@ -199,11 +237,18 @@ Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& devi
|
||||
_hidl_cb(Result::INVALID_ARGUMENTS, nullptr, AudioConfig());
|
||||
return Void();
|
||||
}
|
||||
// Pick the first one as the main until the legacy API is update
|
||||
// Pick the first one as the main.
|
||||
AudioSource source = sinkMetadata.tracks[0].source;
|
||||
return openInputStream(ioHandle, device, config, flags, source, _hidl_cb);
|
||||
AudioConfig suggestedConfig;
|
||||
auto [result, streamIn] =
|
||||
openInputStreamImpl(ioHandle, device, config, flags, source, &suggestedConfig);
|
||||
if (streamIn) {
|
||||
streamIn->updateSinkMetadata(sinkMetadata);
|
||||
}
|
||||
_hidl_cb(result, streamIn, suggestedConfig);
|
||||
return Void();
|
||||
}
|
||||
#endif
|
||||
#endif /* MAJOR_VERSION */
|
||||
|
||||
Return<bool> Device::supportsAudioPatches() {
|
||||
return version() >= AUDIO_DEVICE_API_VERSION_3_0;
|
||||
@@ -260,13 +305,13 @@ Return<Result> Device::setAudioPortConfig(const AudioPortConfig& config) {
|
||||
return Result::NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
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)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> Device::getHwAvSync(getHwAvSync_cb _hidl_cb) {
|
||||
int halHwAvSync;
|
||||
Result retval = getParam(AudioParameter::keyHwAvSync, &halHwAvSync);
|
||||
@@ -279,7 +324,7 @@ Return<Result> Device::setScreenState(bool turnedOn) {
|
||||
return setParam(AudioParameter::keyScreenState, turnedOn);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> Device::getParameters(const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
|
||||
getParametersImpl({}, keys, _hidl_cb);
|
||||
return Void();
|
||||
@@ -288,7 +333,7 @@ Return<void> Device::getParameters(const hidl_vec<hidl_string>& keys, getParamet
|
||||
Return<Result> Device::setParameters(const hidl_vec<ParameterValue>& parameters) {
|
||||
return setParametersImpl({} /* context */, parameters);
|
||||
}
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> Device::getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) {
|
||||
getParametersImpl(context, keys, _hidl_cb);
|
||||
@@ -300,7 +345,7 @@ Return<Result> Device::setParameters(const hidl_vec<ParameterValue>& context,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> Device::debugDump(const hidl_handle& fd) {
|
||||
return debug(fd, {});
|
||||
}
|
||||
@@ -313,7 +358,7 @@ Return<void> Device::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& /
|
||||
return Void();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#if MAJOR_VERSION >= 4
|
||||
Return<void> Device::getMicrophones(getMicrophones_cb _hidl_cb) {
|
||||
Result retval = Result::NOT_SUPPORTED;
|
||||
size_t actual_mics = AUDIO_MICROPHONE_MAX_COUNT;
|
||||
@@ -339,7 +384,7 @@ Return<Result> Device::setConnectedState(const DeviceAddress& address, bool conn
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#define LOG_TAG "DevicesFactoryHAL"
|
||||
|
||||
#include "core/default/DevicesFactory.h"
|
||||
#include "core/default/Device.h"
|
||||
#include "core/default/PrimaryDevice.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -23,10 +27,10 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) {
|
||||
switch (device) {
|
||||
case IDevicesFactory::Device::PRIMARY:
|
||||
@@ -43,8 +47,7 @@ Return<void> DevicesFactory::openDevice(IDevicesFactory::Device device, openDevi
|
||||
_hidl_cb(Result::INVALID_ARGUMENTS, nullptr);
|
||||
return Void();
|
||||
}
|
||||
#endif
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<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);
|
||||
@@ -106,12 +109,12 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* /* name */) {
|
||||
return new DevicesFactory();
|
||||
IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name) {
|
||||
return strcmp(name, "default") == 0 ? new DevicesFactory() : nullptr;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,14 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#include <core/all-versions/default/Conversions.h>
|
||||
#include "core/default/ParametersUtil.h"
|
||||
#include "core/default/Conversions.h"
|
||||
#include "core/default/Util.h"
|
||||
|
||||
#include <system/audio.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
/** Converts a status_t in Result according to the rules of AudioParameter::get*
|
||||
@@ -159,7 +161,7 @@ Result ParametersUtil::setParams(const AudioParameter& param) {
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,23 +14,26 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#define LOG_TAG "PrimaryDeviceHAL"
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#include "core/default/PrimaryDevice.h"
|
||||
#include "core/default/Util.h"
|
||||
|
||||
#if MAJOR_VERSION >= 4
|
||||
#include <cmath>
|
||||
#endif
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
PrimaryDevice::PrimaryDevice(audio_hw_device_t* device) : mDevice(new Device(device)) {}
|
||||
|
||||
PrimaryDevice::~PrimaryDevice() {}
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow.
|
||||
Return<Result> PrimaryDevice::initCheck() {
|
||||
return mDevice->initCheck();
|
||||
}
|
||||
@@ -64,7 +67,7 @@ Return<void> PrimaryDevice::getInputBufferSize(const AudioConfig& config,
|
||||
return mDevice->getInputBufferSize(config, _hidl_cb);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> PrimaryDevice::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config,
|
||||
AudioOutputFlagBitfield flags,
|
||||
@@ -77,7 +80,7 @@ Return<void> PrimaryDevice::openInputStream(int32_t ioHandle, const DeviceAddres
|
||||
AudioSource source, openInputStream_cb _hidl_cb) {
|
||||
return mDevice->openInputStream(ioHandle, device, config, flags, source, _hidl_cb);
|
||||
}
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> PrimaryDevice::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config,
|
||||
AudioOutputFlagBitfield flags,
|
||||
@@ -120,7 +123,7 @@ Return<Result> PrimaryDevice::setScreenState(bool turnedOn) {
|
||||
return mDevice->setScreenState(turnedOn);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<AudioHwSync> PrimaryDevice::getHwAvSync() {
|
||||
return mDevice->getHwAvSync();
|
||||
}
|
||||
@@ -137,7 +140,7 @@ 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)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> PrimaryDevice::getHwAvSync(getHwAvSync_cb _hidl_cb) {
|
||||
return mDevice->getHwAvSync(_hidl_cb);
|
||||
}
|
||||
@@ -158,7 +161,7 @@ Return<Result> PrimaryDevice::setConnectedState(const DeviceAddress& address, bo
|
||||
}
|
||||
#endif
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IPrimaryDevice follow.
|
||||
Return<Result> PrimaryDevice::setVoiceVolume(float volume) {
|
||||
if (!isGainNormalized(volume)) {
|
||||
ALOGW("Can not set a voice volume (%f) outside [0,1]", volume);
|
||||
@@ -271,7 +274,7 @@ Return<Result> PrimaryDevice::setHacEnabled(bool enabled) {
|
||||
return mDevice->setParam(AUDIO_PARAMETER_KEY_HAC, enabled);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#if MAJOR_VERSION >= 4
|
||||
Return<Result> PrimaryDevice::setBtScoHeadsetDebugName(const hidl_string& name) {
|
||||
return mDevice->setParam(AUDIO_PARAMETER_KEY_BT_SCO_HEADSET_NAME, name.c_str());
|
||||
}
|
||||
@@ -307,7 +310,7 @@ Return<void> PrimaryDevice::debug(const hidl_handle& fd, const hidl_vec<hidl_str
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#define LOG_TAG "StreamHAL"
|
||||
|
||||
#include "core/default/Stream.h"
|
||||
#include "common/all-versions/default/EffectMap.h"
|
||||
#include "core/default/Conversions.h"
|
||||
#include "core/default/Util.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -28,7 +33,7 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
Stream::Stream(audio_stream_t* stream) : mStream(stream) {}
|
||||
@@ -42,7 +47,6 @@ Result Stream::analyzeStatus(const char* funcName, int status) {
|
||||
return util::analyzeStatus("stream", funcName, status);
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
Result Stream::analyzeStatus(const char* funcName, int status,
|
||||
const std::vector<int>& ignoreErrors) {
|
||||
@@ -57,7 +61,7 @@ int Stream::halSetParameters(const char* keysAndValues) {
|
||||
return mStream->set_parameters(mStream, keysAndValues);
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
|
||||
Return<uint64_t> Stream::getFrameSize() {
|
||||
// Needs to be implemented by interface subclasses. But can't be declared as pure virtual,
|
||||
// since interface subclasses implementation do not inherit from this class.
|
||||
@@ -79,7 +83,7 @@ Return<uint32_t> Stream::getSampleRate() {
|
||||
return mStream->get_sample_rate(mStream);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> Stream::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
|
||||
return getSupportedSampleRates(getFormat(), _hidl_cb);
|
||||
}
|
||||
@@ -107,9 +111,9 @@ Return<void> Stream::getSupportedSampleRates(AudioFormat format,
|
||||
result = Result::NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
_hidl_cb(sampleRates);
|
||||
#elif AUDIO_HAL_VERSION_4_0
|
||||
#elif MAJOR_VERSION >= 4
|
||||
_hidl_cb(result, sampleRates);
|
||||
#endif
|
||||
return Void();
|
||||
@@ -136,9 +140,9 @@ Return<void> Stream::getSupportedChannelMasks(AudioFormat format,
|
||||
result = Result::NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
_hidl_cb(channelMasks);
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
_hidl_cb(result, channelMasks);
|
||||
#endif
|
||||
return Void();
|
||||
@@ -217,7 +221,7 @@ Return<Result> Stream::setHwAvSync(uint32_t hwAvSync) {
|
||||
return setParam(AudioParameter::keyStreamHwAvSync, static_cast<int>(hwAvSync));
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<AudioDevice> Stream::getDevice() {
|
||||
int device = 0;
|
||||
Result retval = getParam(AudioParameter::keyRouting, &device);
|
||||
@@ -242,7 +246,7 @@ Return<Result> Stream::setConnectedState(const DeviceAddress& address, bool conn
|
||||
connected ? AudioParameter::keyStreamConnect : AudioParameter::keyStreamDisconnect,
|
||||
address);
|
||||
}
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> Stream::getDevices(getDevices_cb _hidl_cb) {
|
||||
int device = 0;
|
||||
Result retval = getParam(AudioParameter::keyRouting, &device);
|
||||
@@ -314,14 +318,14 @@ Return<void> Stream::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& /
|
||||
return Void();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> Stream::debugDump(const hidl_handle& fd) {
|
||||
return debug(fd, {} /* options */);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#define LOG_TAG "StreamInHAL"
|
||||
|
||||
#include "core/default/StreamIn.h"
|
||||
#include "core/default/Conversions.h"
|
||||
#include "core/default/Util.h"
|
||||
#include "common/all-versions/HidlSupport.h"
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define ATRACE_TAG ATRACE_TAG_AUDIO
|
||||
@@ -23,18 +28,14 @@
|
||||
#include <hardware/audio.h>
|
||||
#include <utils/Trace.h>
|
||||
#include <memory>
|
||||
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::MessageQueueFlagBits;
|
||||
#include "Conversions.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
|
||||
|
||||
namespace {
|
||||
|
||||
class ReadThread : public Thread {
|
||||
@@ -162,7 +163,7 @@ StreamIn::~StreamIn() {
|
||||
mStream = nullptr;
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
|
||||
Return<uint64_t> StreamIn::getFrameSize() {
|
||||
return audio_stream_in_frame_size(mStream);
|
||||
}
|
||||
@@ -179,7 +180,7 @@ Return<uint32_t> StreamIn::getSampleRate() {
|
||||
return mStreamCommon->getSampleRate();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> StreamIn::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
|
||||
}
|
||||
@@ -241,7 +242,7 @@ Return<Result> StreamIn::setHwAvSync(uint32_t hwAvSync) {
|
||||
return mStreamCommon->setHwAvSync(hwAvSync);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<Result> StreamIn::setConnectedState(const DeviceAddress& address, bool connected) {
|
||||
return mStreamCommon->setConnectedState(address, connected);
|
||||
}
|
||||
@@ -265,7 +266,7 @@ 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)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> StreamIn::getDevices(getDevices_cb _hidl_cb) {
|
||||
return mStreamCommon->getDevices(_hidl_cb);
|
||||
}
|
||||
@@ -313,7 +314,7 @@ Return<Result> StreamIn::close() {
|
||||
return Result::OK;
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStreamIn follow.
|
||||
Return<void> StreamIn::getAudioSource(getAudioSource_cb _hidl_cb) {
|
||||
int halSource;
|
||||
Result retval = mStreamCommon->getParam(AudioParameter::keyInputSource, &halSource);
|
||||
@@ -342,7 +343,6 @@ Return<void> StreamIn::prepareForReading(uint32_t frameSize, uint32_t framesCoun
|
||||
auto sendError = [&threadInfo, &_hidl_cb](Result result) {
|
||||
_hidl_cb(result, CommandMQ::Descriptor(), DataMQ::Descriptor(), StatusMQ::Descriptor(),
|
||||
threadInfo);
|
||||
|
||||
};
|
||||
|
||||
// Create message queues.
|
||||
@@ -448,7 +448,7 @@ Return<void> StreamIn::debug(const hidl_handle& fd, const hidl_vec<hidl_string>&
|
||||
return mStreamCommon->debug(fd, options);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#if MAJOR_VERSION >= 4
|
||||
Return<void> StreamIn::updateSinkMetadata(const SinkMetadata& sinkMetadata) {
|
||||
if (mStream->update_sink_metadata == nullptr) {
|
||||
return Void(); // not supported by the HAL
|
||||
@@ -456,11 +456,23 @@ Return<void> StreamIn::updateSinkMetadata(const SinkMetadata& sinkMetadata) {
|
||||
std::vector<record_track_metadata> halTracks;
|
||||
halTracks.reserve(sinkMetadata.tracks.size());
|
||||
for (auto& metadata : sinkMetadata.tracks) {
|
||||
halTracks.push_back(
|
||||
{.source = static_cast<audio_source_t>(metadata.source), .gain = metadata.gain});
|
||||
record_track_metadata halTrackMetadata = {
|
||||
.source = static_cast<audio_source_t>(metadata.source), .gain = metadata.gain};
|
||||
#if MAJOR_VERSION >= 5
|
||||
if (metadata.destination.getDiscriminator() ==
|
||||
RecordTrackMetadata::Destination::hidl_discriminator::device) {
|
||||
halTrackMetadata.dest_device =
|
||||
static_cast<audio_devices_t>(metadata.destination.device().device);
|
||||
strncpy(halTrackMetadata.dest_device_address,
|
||||
deviceAddressToHal(metadata.destination.device()).c_str(),
|
||||
AUDIO_DEVICE_MAX_ADDRESS_LEN);
|
||||
}
|
||||
#endif
|
||||
halTracks.push_back(halTrackMetadata);
|
||||
}
|
||||
const sink_metadata_t halMetadata = {
|
||||
.track_count = halTracks.size(), .tracks = halTracks.data(),
|
||||
.track_count = halTracks.size(),
|
||||
.tracks = halTracks.data(),
|
||||
};
|
||||
mStream->update_sink_metadata(mStream, &halMetadata);
|
||||
return Void();
|
||||
@@ -486,8 +498,37 @@ Return<void> StreamIn::getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MAJOR_VERSION >= 5
|
||||
Return<Result> StreamIn::setMicrophoneDirection(MicrophoneDirection direction) {
|
||||
if (mStream->set_microphone_direction == nullptr) {
|
||||
return Result::NOT_SUPPORTED;
|
||||
}
|
||||
if (!common::utils::isValidHidlEnum(direction)) {
|
||||
ALOGE("%s: Invalid direction %d", __func__, direction);
|
||||
return Result::INVALID_ARGUMENTS;
|
||||
}
|
||||
return Stream::analyzeStatus(
|
||||
"set_microphone_direction",
|
||||
mStream->set_microphone_direction(
|
||||
mStream, static_cast<audio_microphone_direction_t>(direction)));
|
||||
}
|
||||
|
||||
Return<Result> StreamIn::setMicrophoneFieldDimension(float zoom) {
|
||||
if (mStream->set_microphone_field_dimension == nullptr) {
|
||||
return Result::NOT_SUPPORTED;
|
||||
}
|
||||
if (std::isnan(zoom) || zoom < -1 || zoom > 1) {
|
||||
ALOGE("%s: Invalid zoom %f", __func__, zoom);
|
||||
return Result::INVALID_ARGUMENTS;
|
||||
}
|
||||
return Stream::analyzeStatus("set_microphone_field_dimension",
|
||||
mStream->set_microphone_field_dimension(mStream, zoom));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#define LOG_TAG "StreamOutHAL"
|
||||
|
||||
#include "core/default/StreamOut.h"
|
||||
#include "core/default/Util.h"
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define ATRACE_TAG ATRACE_TAG_AUDIO
|
||||
@@ -28,11 +31,9 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
|
||||
|
||||
namespace {
|
||||
|
||||
class WriteThread : public Thread {
|
||||
@@ -165,7 +166,7 @@ StreamOut::~StreamOut() {
|
||||
mStream = nullptr;
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
|
||||
Return<uint64_t> StreamOut::getFrameSize() {
|
||||
return audio_stream_out_frame_size(mStream);
|
||||
}
|
||||
@@ -182,7 +183,7 @@ Return<uint32_t> StreamOut::getSampleRate() {
|
||||
return mStreamCommon->getSampleRate();
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> StreamOut::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
|
||||
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
|
||||
}
|
||||
@@ -244,7 +245,7 @@ Return<Result> StreamOut::setHwAvSync(uint32_t hwAvSync) {
|
||||
return mStreamCommon->setHwAvSync(hwAvSync);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<Result> StreamOut::setConnectedState(const DeviceAddress& address, bool connected) {
|
||||
return mStreamCommon->setConnectedState(address, connected);
|
||||
}
|
||||
@@ -269,7 +270,7 @@ 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)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> StreamOut::getDevices(getDevices_cb _hidl_cb) {
|
||||
return mStreamCommon->getDevices(_hidl_cb);
|
||||
}
|
||||
@@ -301,7 +302,7 @@ Return<Result> StreamOut::close() {
|
||||
return Result::OK;
|
||||
}
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStreamOut follow.
|
||||
Return<uint32_t> StreamOut::getLatency() {
|
||||
return mStream->get_latency(mStream);
|
||||
}
|
||||
@@ -326,7 +327,6 @@ Return<void> StreamOut::prepareForWriting(uint32_t frameSize, uint32_t framesCou
|
||||
auto sendError = [&threadInfo, &_hidl_cb](Result result) {
|
||||
_hidl_cb(result, CommandMQ::Descriptor(), DataMQ::Descriptor(), StatusMQ::Descriptor(),
|
||||
threadInfo);
|
||||
|
||||
};
|
||||
|
||||
// Create message queues.
|
||||
@@ -545,7 +545,7 @@ Return<void> StreamOut::debug(const hidl_handle& fd, const hidl_vec<hidl_string>
|
||||
return mStreamCommon->debug(fd, options);
|
||||
}
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#if MAJOR_VERSION >= 4
|
||||
Return<void> StreamOut::updateSourceMetadata(const SourceMetadata& sourceMetadata) {
|
||||
if (mStream->update_source_metadata == nullptr) {
|
||||
return Void(); // not supported by the HAL
|
||||
@@ -560,7 +560,8 @@ Return<void> StreamOut::updateSourceMetadata(const SourceMetadata& sourceMetadat
|
||||
});
|
||||
}
|
||||
const source_metadata_t halMetadata = {
|
||||
.track_count = halTracks.size(), .tracks = halTracks.data(),
|
||||
.track_count = halTracks.size(),
|
||||
.tracks = halTracks.data(),
|
||||
};
|
||||
mStream->update_source_metadata(mStream, &halMetadata);
|
||||
return Void();
|
||||
@@ -571,7 +572,7 @@ Return<Result> StreamOut::selectPresentation(int32_t /*presentationId*/, int32_t
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_CONVERSIONS_H_
|
||||
#define ANDROID_HARDWARE_AUDIO_CONVERSIONS_H_
|
||||
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/types.h)
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -23,20 +26,23 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
std::string deviceAddressToHal(const DeviceAddress& address);
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#if MAJOR_VERSION >= 4
|
||||
bool halToMicrophoneCharacteristics(MicrophoneInfo* pDst,
|
||||
const struct audio_microphone_characteristic_t& src);
|
||||
#endif
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_CONVERSIONS_H_
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_DEVICE_H
|
||||
#define ANDROID_HARDWARE_AUDIO_DEVICE_H
|
||||
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/IDevice.h)
|
||||
|
||||
#include "ParametersUtil.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -30,41 +35,23 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioHwSync;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPatchHandle;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioInputFlagBitfield;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::
|
||||
AudioOutputFlagBitfield;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
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
|
||||
using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioInputFlagBitfield;
|
||||
using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioOutputFlagBitfield;
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
struct Device : public IDevice, public ParametersUtil {
|
||||
explicit Device(audio_hw_device_t* device);
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow.
|
||||
Return<Result> initCheck() override;
|
||||
Return<Result> setMasterVolume(float volume) override;
|
||||
Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
|
||||
@@ -75,15 +62,22 @@ struct Device : public IDevice, public ParametersUtil {
|
||||
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
|
||||
std::tuple<Result, sp<IStreamOut>> openOutputStreamImpl(int32_t ioHandle,
|
||||
const DeviceAddress& device,
|
||||
const AudioConfig& config,
|
||||
AudioOutputFlagBitfield flags,
|
||||
AudioConfig* suggestedConfig);
|
||||
std::tuple<Result, sp<IStreamIn>> openInputStreamImpl(
|
||||
int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config,
|
||||
AudioInputFlagBitfield flags, AudioSource source, AudioConfig* suggestedConfig);
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
openOutputStream_cb _hidl_cb) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb) override;
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
const SourceMetadata& sourceMetadata,
|
||||
@@ -104,13 +98,13 @@ struct Device : public IDevice, public ParametersUtil {
|
||||
|
||||
Return<Result> setScreenState(bool turnedOn) override;
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
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)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> getHwAvSync(getHwAvSync_cb _hidl_cb) override;
|
||||
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
@@ -124,7 +118,8 @@ struct Device : public IDevice, public ParametersUtil {
|
||||
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);
|
||||
Result analyzeStatus(const char* funcName, int status,
|
||||
const std::vector<int>& ignoreErrors = {});
|
||||
void closeInputStream(audio_stream_in_t* stream);
|
||||
void closeOutputStream(audio_stream_out_t* stream);
|
||||
audio_hw_device_t* device() const { return mDevice; }
|
||||
@@ -142,7 +137,9 @@ struct Device : public IDevice, public ParametersUtil {
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_DEVICE_H
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_DEVICESFACTORY_H
|
||||
#define ANDROID_HARDWARE_AUDIO_DEVICESFACTORY_H
|
||||
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h)
|
||||
|
||||
#include <hardware/audio.h>
|
||||
|
||||
@@ -24,23 +27,20 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
struct DevicesFactory : public IDevicesFactory {
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) override;
|
||||
#endif
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> openDevice(const hidl_string& device, openDevice_cb _hidl_cb) override;
|
||||
Return<void> openPrimaryDevice(openPrimaryDevice_cb _hidl_cb) override;
|
||||
#endif
|
||||
@@ -56,7 +56,9 @@ struct DevicesFactory : public IDevicesFactory {
|
||||
extern "C" IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_DEVICESFACTORY_H
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_
|
||||
#define ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_
|
||||
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/types.h)
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
@@ -25,14 +28,13 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
class ParametersUtil {
|
||||
public:
|
||||
@@ -60,7 +62,9 @@ class ParametersUtil {
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H
|
||||
#define ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H
|
||||
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/IPrimaryDevice.h)
|
||||
|
||||
#include "Device.h"
|
||||
|
||||
#include <hidl/Status.h>
|
||||
|
||||
@@ -23,33 +28,21 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
struct PrimaryDevice : public IPrimaryDevice {
|
||||
explicit PrimaryDevice(audio_hw_device_t* device);
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow.
|
||||
Return<Result> initCheck() override;
|
||||
Return<Result> setMasterVolume(float volume) override;
|
||||
Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
|
||||
@@ -62,7 +55,7 @@ struct PrimaryDevice : public IPrimaryDevice {
|
||||
|
||||
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioOutputFlagBitfield flags,
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#if MAJOR_VERSION >= 4
|
||||
const SourceMetadata& sourceMetadata,
|
||||
#endif
|
||||
openOutputStream_cb _hidl_cb) override;
|
||||
@@ -70,7 +63,7 @@ struct PrimaryDevice : public IPrimaryDevice {
|
||||
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
AudioSource source, openInputStream_cb _hidl_cb);
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#if MAJOR_VERSION >= 4
|
||||
Return<void> openInputStream(int32_t ioHandle, const DeviceAddress& device,
|
||||
const AudioConfig& config, AudioInputFlagBitfield flags,
|
||||
const SinkMetadata& sinkMetadata,
|
||||
@@ -87,13 +80,13 @@ struct PrimaryDevice : public IPrimaryDevice {
|
||||
|
||||
Return<Result> setScreenState(bool turnedOn) override;
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
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)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
Return<void> getHwAvSync(getHwAvSync_cb _hidl_cb) override;
|
||||
Return<void> getParameters(const hidl_vec<ParameterValue>& context,
|
||||
const hidl_vec<hidl_string>& keys,
|
||||
@@ -106,7 +99,7 @@ struct PrimaryDevice : public IPrimaryDevice {
|
||||
|
||||
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IPrimaryDevice follow.
|
||||
Return<Result> setVoiceVolume(float volume) override;
|
||||
Return<Result> setMode(AudioMode mode) override;
|
||||
Return<void> getBtScoNrecEnabled(getBtScoNrecEnabled_cb _hidl_cb) override;
|
||||
@@ -118,7 +111,7 @@ struct PrimaryDevice : public IPrimaryDevice {
|
||||
Return<void> getHacEnabled(getHacEnabled_cb _hidl_cb) override;
|
||||
Return<Result> setHacEnabled(bool enabled) override;
|
||||
|
||||
#ifdef AUDIO_HAL_VERSION_4_0
|
||||
#if MAJOR_VERSION >= 4
|
||||
Return<Result> setBtScoHeadsetDebugName(const hidl_string& name) override;
|
||||
Return<void> getBtHfpEnabled(getBtHfpEnabled_cb _hidl_cb) override;
|
||||
Return<Result> setBtHfpEnabled(bool enabled) override;
|
||||
@@ -134,7 +127,9 @@ struct PrimaryDevice : public IPrimaryDevice {
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_STREAM_H
|
||||
#define ANDROID_HARDWARE_AUDIO_STREAM_H
|
||||
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/IStream.h)
|
||||
|
||||
#include "ParametersUtil.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -28,22 +33,17 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::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;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield;
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
struct Stream : public IStream, public ParametersUtil {
|
||||
explicit Stream(audio_stream_t* stream);
|
||||
@@ -55,12 +55,12 @@ struct Stream : public IStream, public ParametersUtil {
|
||||
*/
|
||||
static constexpr uint32_t MAX_BUFFER_SIZE = 2 << 30 /* == 1GiB */;
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
|
||||
Return<uint64_t> getFrameSize() override;
|
||||
Return<uint64_t> getFrameCount() override;
|
||||
Return<uint64_t> getBufferSize() override;
|
||||
Return<uint32_t> getSampleRate() override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
|
||||
Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
|
||||
#endif
|
||||
@@ -76,14 +76,14 @@ 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
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<AudioDevice> getDevice() override;
|
||||
Return<Result> setDevice(const DeviceAddress& address) 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<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
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,
|
||||
@@ -100,7 +100,7 @@ struct Stream : public IStream, public ParametersUtil {
|
||||
Return<Result> close() override;
|
||||
|
||||
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
#endif
|
||||
|
||||
@@ -171,7 +171,7 @@ Return<void> StreamMmap<T>::createMmapBuffer(int32_t minSizeFrames, size_t frame
|
||||
halInfo.buffer_size_frames = abs(halInfo.buffer_size_frames);
|
||||
info.sharedMemory = // hidl_memory size must always be positive
|
||||
hidl_memory("audio_buffer", hidlHandle, frameSize * halInfo.buffer_size_frames);
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
if (applicationShareable) {
|
||||
halInfo.buffer_size_frames *= -1;
|
||||
}
|
||||
@@ -210,7 +210,9 @@ Return<void> StreamMmap<T>::getMmapPosition(IStream::getMmapPosition_cb _hidl_cb
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_STREAM_H
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_STREAMIN_H
|
||||
#define ANDROID_HARDWARE_AUDIO_STREAMIN_H
|
||||
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/IStreamIn.h)
|
||||
|
||||
#include "Device.h"
|
||||
#include "Stream.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
@@ -28,23 +34,16 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
struct StreamIn : public IStreamIn {
|
||||
typedef MessageQueue<ReadParameters, kSynchronizedReadWrite> CommandMQ;
|
||||
@@ -53,12 +52,12 @@ struct StreamIn : public IStreamIn {
|
||||
|
||||
StreamIn(const sp<Device>& device, audio_stream_in_t* stream);
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
|
||||
Return<uint64_t> getFrameSize() override;
|
||||
Return<uint64_t> getFrameCount() override;
|
||||
Return<uint64_t> getBufferSize() override;
|
||||
Return<uint32_t> getSampleRate() override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
|
||||
Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
|
||||
#endif
|
||||
@@ -74,14 +73,14 @@ 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
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<AudioDevice> getDevice() override;
|
||||
Return<Result> setDevice(const DeviceAddress& address) 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<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
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,
|
||||
@@ -94,11 +93,11 @@ struct StreamIn : public IStreamIn {
|
||||
Return<Result> close() override;
|
||||
|
||||
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
#endif
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStreamIn follow.
|
||||
Return<void> getAudioSource(getAudioSource_cb _hidl_cb) override;
|
||||
Return<Result> setGain(float gain) override;
|
||||
Return<void> prepareForReading(uint32_t frameSize, uint32_t framesCount,
|
||||
@@ -109,11 +108,14 @@ 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
|
||||
#if MAJOR_VERSION >= 4
|
||||
Return<void> updateSinkMetadata(const SinkMetadata& sinkMetadata) override;
|
||||
Return<void> getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) override;
|
||||
#endif
|
||||
|
||||
#if MAJOR_VERSION >= 5
|
||||
Return<Result> setMicrophoneDirection(MicrophoneDirection direction) override;
|
||||
Return<Result> setMicrophoneFieldDimension(float zoom) override;
|
||||
#endif
|
||||
static Result getCapturePositionImpl(audio_stream_in_t* stream, uint64_t* frames,
|
||||
uint64_t* time);
|
||||
|
||||
@@ -134,7 +136,9 @@ struct StreamIn : public IStreamIn {
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_STREAMIN_H
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2016 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_STREAMOUT_H
|
||||
#define ANDROID_HARDWARE_AUDIO_STREAMOUT_H
|
||||
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/IStreamOut.h)
|
||||
|
||||
#include "Device.h"
|
||||
#include "Stream.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
@@ -28,25 +34,16 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
|
||||
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::AudioDrain;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOutCallback;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::TimeSpec;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
struct StreamOut : public IStreamOut {
|
||||
typedef MessageQueue<WriteCommand, kSynchronizedReadWrite> CommandMQ;
|
||||
@@ -55,12 +52,12 @@ struct StreamOut : public IStreamOut {
|
||||
|
||||
StreamOut(const sp<Device>& device, audio_stream_out_t* stream);
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
|
||||
Return<uint64_t> getFrameSize() override;
|
||||
Return<uint64_t> getFrameCount() override;
|
||||
Return<uint64_t> getBufferSize() override;
|
||||
Return<uint32_t> getSampleRate() override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override;
|
||||
Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override;
|
||||
#endif
|
||||
@@ -76,14 +73,14 @@ 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
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<AudioDevice> getDevice() override;
|
||||
Return<Result> setDevice(const DeviceAddress& address) 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<Result> setConnectedState(const DeviceAddress& address, bool connected) override;
|
||||
#elif defined(AUDIO_HAL_VERSION_4_0)
|
||||
#elif MAJOR_VERSION >= 4
|
||||
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,
|
||||
@@ -96,11 +93,11 @@ struct StreamOut : public IStreamOut {
|
||||
Return<Result> close() override;
|
||||
|
||||
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
|
||||
#ifdef AUDIO_HAL_VERSION_2_0
|
||||
#if MAJOR_VERSION == 2
|
||||
Return<void> debugDump(const hidl_handle& fd) override;
|
||||
#endif
|
||||
|
||||
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow.
|
||||
// Methods from ::android::hardware::audio::CPP_VERSION::IStreamOut follow.
|
||||
Return<uint32_t> getLatency() override;
|
||||
Return<Result> setVolume(float left, float right) override;
|
||||
Return<void> prepareForWriting(uint32_t frameSize, uint32_t framesCount,
|
||||
@@ -120,7 +117,7 @@ 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
|
||||
#if MAJOR_VERSION >= 4
|
||||
Return<void> updateSourceMetadata(const SourceMetadata& sourceMetadata) override;
|
||||
Return<Result> selectPresentation(int32_t presentationId, int32_t programId) override;
|
||||
#endif
|
||||
@@ -148,7 +145,9 @@ struct StreamOut : public IStreamOut {
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_STREAMOUT_H
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <common/all-versions/IncludeGuard.h>
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_UTIL_H
|
||||
#define ANDROID_HARDWARE_AUDIO_UTIL_H
|
||||
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/types.h)
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
@@ -24,10 +27,11 @@
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace audio {
|
||||
namespace AUDIO_HAL_VERSION {
|
||||
namespace CPP_VERSION {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
/** @return true if gain is between 0 and 1 included. */
|
||||
constexpr bool isGainNormalized(float gain) {
|
||||
@@ -68,7 +72,9 @@ static inline Result analyzeStatus(const char* className, const char* funcName,
|
||||
|
||||
} // namespace util
|
||||
} // namespace implementation
|
||||
} // namespace AUDIO_HAL_VERSION
|
||||
} // namespace CPP_VERSION
|
||||
} // namespace audio
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_UTIL_H
|
||||
@@ -2,4 +2,4 @@ elaurent@google.com
|
||||
krocard@google.com
|
||||
mnaganov@google.com
|
||||
yim@google.com
|
||||
zhuoyao@google.com
|
||||
zhuoyao@google.com
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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 "AudioPrimaryHidlHalTest.h"
|
||||
|
||||
static void testGetDevice(IStream* stream, AudioDevice expectedDevice) {
|
||||
// Unfortunately the interface does not allow the implementation to return
|
||||
// NOT_SUPPORTED
|
||||
// Thus allow NONE as signaling that the call is not supported.
|
||||
auto ret = stream->getDevice();
|
||||
ASSERT_IS_OK(ret);
|
||||
AudioDevice device = ret;
|
||||
ASSERT_TRUE(device == expectedDevice || device == AudioDevice::NONE)
|
||||
<< "Expected: " << ::testing::PrintToString(expectedDevice)
|
||||
<< "\n Actual: " << ::testing::PrintToString(device);
|
||||
}
|
||||
|
||||
TEST_IO_STREAM(GetDevice, "Check that the stream device == the one it was opened with",
|
||||
areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
|
||||
: testGetDevice(stream.get(), address.device))
|
||||
|
||||
static void testSetDevice(IStream* stream, const DeviceAddress& address) {
|
||||
DeviceAddress otherAddress = address;
|
||||
otherAddress.device = (address.device & AudioDevice::BIT_IN) == 0 ? AudioDevice::OUT_SPEAKER
|
||||
: AudioDevice::IN_BUILTIN_MIC;
|
||||
EXPECT_OK(stream->setDevice(otherAddress));
|
||||
|
||||
ASSERT_OK(stream->setDevice(address)); // Go back to the original value
|
||||
}
|
||||
|
||||
TEST_IO_STREAM(SetDevice, "Check that the stream can be rerouted to SPEAKER or BUILTIN_MIC",
|
||||
areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
|
||||
: testSetDevice(stream.get(), address))
|
||||
|
||||
static void testConnectedState(IStream* stream) {
|
||||
DeviceAddress address = {};
|
||||
using AD = AudioDevice;
|
||||
for (auto device : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) {
|
||||
address.device = device;
|
||||
|
||||
ASSERT_OK(stream->setConnectedState(address, true));
|
||||
ASSERT_OK(stream->setConnectedState(address, false));
|
||||
}
|
||||
}
|
||||
TEST_IO_STREAM(SetConnectedState,
|
||||
"Check that the stream can be notified of device connection and "
|
||||
"deconnection",
|
||||
testConnectedState(stream.get()))
|
||||
|
||||
TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail", ASSERT_IS_OK(device->getHwAvSync()));
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, setMode) {
|
||||
doc::test("Make sure setMode always succeeds if mode is valid and fails otherwise");
|
||||
// Test Invalid values
|
||||
for (AudioMode mode : {AudioMode::INVALID, AudioMode::CURRENT, AudioMode::CNT}) {
|
||||
SCOPED_TRACE("mode=" + toString(mode));
|
||||
ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(mode));
|
||||
}
|
||||
// Test valid values
|
||||
for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
|
||||
AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
|
||||
SCOPED_TRACE("mode=" + toString(mode));
|
||||
ASSERT_OK(device->setMode(mode));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 PATH(android/hardware/audio/FILE_VERSION/IStream.h)
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/types.h)
|
||||
#include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
|
||||
#include <hidl/HidlSupport.h>
|
||||
|
||||
using ::android::hardware::hidl_handle;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
|
||||
using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
|
||||
using ::android::hardware::audio::CPP_VERSION::IStream;
|
||||
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
|
||||
using ::android::hardware::audio::CPP_VERSION::Result;
|
||||
|
||||
using namespace ::android::hardware::audio::common::test::utility;
|
||||
|
||||
struct Parameters {
|
||||
template <class T, class ReturnIn>
|
||||
static auto get(T t, hidl_vec<hidl_string> keys, ReturnIn returnIn) {
|
||||
return t->getParameters(keys, returnIn);
|
||||
}
|
||||
template <class T>
|
||||
static auto set(T t, hidl_vec<ParameterValue> values) {
|
||||
return t->setParameters(values);
|
||||
}
|
||||
};
|
||||
|
||||
// The default hal should probably return a NOT_SUPPORTED if the hal
|
||||
// does not expose
|
||||
// capability retrieval. For now it returns an empty list if not
|
||||
// implemented
|
||||
struct GetSupported {
|
||||
template <class Vec>
|
||||
static Result convertToResult(const Vec& vec) {
|
||||
return vec.size() == 0 ? Result::NOT_SUPPORTED : Result::OK;
|
||||
}
|
||||
|
||||
static Result sampleRates(IStream* stream, hidl_vec<uint32_t>& rates) {
|
||||
EXPECT_OK(stream->getSupportedSampleRates(returnIn(rates)));
|
||||
return convertToResult(rates);
|
||||
}
|
||||
|
||||
static Result channelMasks(IStream* stream, hidl_vec<AudioChannelMask>& channels) {
|
||||
EXPECT_OK(stream->getSupportedChannelMasks(returnIn(channels)));
|
||||
return convertToResult(channels);
|
||||
}
|
||||
|
||||
static Result formats(IStream* stream, hidl_vec<AudioFormat>& capabilities) {
|
||||
EXPECT_OK(stream->getSupportedFormats(returnIn(capabilities)));
|
||||
// TODO: this should be an optional function
|
||||
return Result::OK;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
auto dump(T t, hidl_handle handle) {
|
||||
return t->debugDump(handle);
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
* 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 "AudioPrimaryHidlHalTest.h"
|
||||
|
||||
static void waitForDeviceDestruction() {
|
||||
// FIXME: there is no way to know when the remote IDevice is being destroyed
|
||||
// Binder does not support testing if an object is alive, thus
|
||||
// wait for 100ms to let the binder destruction propagates and
|
||||
// the remote device has the time to be destroyed.
|
||||
// flushCommand makes sure all local command are sent, thus should reduce
|
||||
// the latency between local and remote destruction.
|
||||
IPCThreadState::self()->flushCommands();
|
||||
usleep(100);
|
||||
}
|
||||
|
||||
TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) {
|
||||
doc::test("Calling openDevice(\"primary\") should return the primary device.");
|
||||
{
|
||||
Result result;
|
||||
sp<IDevice> baseDevice;
|
||||
ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice)));
|
||||
ASSERT_OK(result);
|
||||
ASSERT_TRUE(baseDevice != nullptr);
|
||||
|
||||
Return<sp<IPrimaryDevice>> primaryDevice = IPrimaryDevice::castFrom(baseDevice);
|
||||
ASSERT_TRUE(primaryDevice.isOk());
|
||||
ASSERT_TRUE(sp<IPrimaryDevice>(primaryDevice) != nullptr);
|
||||
} // Destroy local IDevice proxy
|
||||
waitForDeviceDestruction();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////// get(Active)Microphones ///////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, GetMicrophonesTest) {
|
||||
doc::test("Make sure getMicrophones always succeeds");
|
||||
hidl_vec<MicrophoneInfo> microphones;
|
||||
ASSERT_OK(device->getMicrophones(returnIn(res, microphones)));
|
||||
ASSERT_OK(res);
|
||||
if (microphones.size() > 0) {
|
||||
// When there is microphone on the phone, try to open an input stream
|
||||
// and query for the active microphones.
|
||||
doc::test(
|
||||
"Make sure getMicrophones always succeeds"
|
||||
"and getActiveMicrophones always succeeds when recording from these microphones.");
|
||||
AudioIoHandle ioHandle = (AudioIoHandle)AudioHandleConsts::AUDIO_IO_HANDLE_NONE;
|
||||
AudioConfig config{};
|
||||
config.channelMask = mkEnumBitfield(AudioChannelMask::IN_MONO);
|
||||
config.sampleRateHz = 8000;
|
||||
config.format = AudioFormat::PCM_16_BIT;
|
||||
auto flags = hidl_bitfield<AudioInputFlag>(AudioInputFlag::NONE);
|
||||
const SinkMetadata initMetadata = {{{.source = AudioSource::MIC, .gain = 1}}};
|
||||
EventFlag* efGroup;
|
||||
for (auto microphone : microphones) {
|
||||
if (microphone.deviceAddress.device != AudioDevice::IN_BUILTIN_MIC) {
|
||||
continue;
|
||||
}
|
||||
sp<IStreamIn> stream;
|
||||
AudioConfig suggestedConfig{};
|
||||
ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress, config, flags,
|
||||
initMetadata,
|
||||
returnIn(res, stream, suggestedConfig)));
|
||||
if (res != Result::OK) {
|
||||
ASSERT_TRUE(stream == nullptr);
|
||||
AudioConfig suggestedConfigRetry{};
|
||||
ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress,
|
||||
suggestedConfig, flags, initMetadata,
|
||||
returnIn(res, stream, suggestedConfigRetry)));
|
||||
}
|
||||
ASSERT_OK(res);
|
||||
hidl_vec<MicrophoneInfo> activeMicrophones;
|
||||
Result readRes;
|
||||
typedef MessageQueue<IStreamIn::ReadParameters, kSynchronizedReadWrite> CommandMQ;
|
||||
typedef MessageQueue<uint8_t, kSynchronizedReadWrite> DataMQ;
|
||||
std::unique_ptr<CommandMQ> commandMQ;
|
||||
std::unique_ptr<DataMQ> dataMQ;
|
||||
size_t frameSize = stream->getFrameSize();
|
||||
size_t frameCount = stream->getBufferSize() / frameSize;
|
||||
ASSERT_OK(stream->prepareForReading(
|
||||
frameSize, frameCount, [&](auto r, auto& c, auto& d, auto&, auto&) {
|
||||
readRes = r;
|
||||
if (readRes == Result::OK) {
|
||||
commandMQ.reset(new CommandMQ(c));
|
||||
dataMQ.reset(new DataMQ(d));
|
||||
if (dataMQ->isValid() && dataMQ->getEventFlagWord()) {
|
||||
EventFlag::createEventFlag(dataMQ->getEventFlagWord(), &efGroup);
|
||||
}
|
||||
}
|
||||
}));
|
||||
ASSERT_OK(readRes);
|
||||
IStreamIn::ReadParameters params;
|
||||
params.command = IStreamIn::ReadCommand::READ;
|
||||
ASSERT_TRUE(commandMQ != nullptr);
|
||||
ASSERT_TRUE(commandMQ->isValid());
|
||||
ASSERT_TRUE(commandMQ->write(¶ms));
|
||||
efGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL));
|
||||
uint32_t efState = 0;
|
||||
efGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY), &efState);
|
||||
if (efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY)) {
|
||||
ASSERT_OK(stream->getActiveMicrophones(returnIn(res, activeMicrophones)));
|
||||
ASSERT_OK(res);
|
||||
ASSERT_NE(0U, activeMicrophones.size());
|
||||
}
|
||||
stream->close();
|
||||
if (efGroup) {
|
||||
EventFlag::deleteEventFlag(&efGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, SetConnectedState) {
|
||||
doc::test("Check that the HAL can be notified of device connection and deconnection");
|
||||
using AD = AudioDevice;
|
||||
for (auto deviceType : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) {
|
||||
SCOPED_TRACE("device=" + ::testing::PrintToString(deviceType));
|
||||
for (bool state : {true, false}) {
|
||||
SCOPED_TRACE("state=" + ::testing::PrintToString(state));
|
||||
DeviceAddress address = {};
|
||||
address.device = deviceType;
|
||||
auto ret = device->setConnectedState(address, state);
|
||||
ASSERT_TRUE(ret.isOk());
|
||||
if (ret == Result::NOT_SUPPORTED) {
|
||||
doc::partialTest("setConnectedState is not supported");
|
||||
break; // other deviceType might be supported
|
||||
}
|
||||
ASSERT_OK(ret);
|
||||
}
|
||||
}
|
||||
|
||||
// Because there is no way of knowing if the devices were connected before
|
||||
// calling setConnectedState, there is no way to restore the HAL to its
|
||||
// initial state. To workaround this, destroy the HAL at the end of this test.
|
||||
device.clear();
|
||||
waitForDeviceDestruction();
|
||||
}
|
||||
|
||||
static void testGetDevices(IStream* stream, AudioDevice expectedDevice) {
|
||||
hidl_vec<DeviceAddress> devices;
|
||||
Result res;
|
||||
ASSERT_OK(stream->getDevices(returnIn(res, devices)));
|
||||
if (res == Result::NOT_SUPPORTED) {
|
||||
return doc::partialTest("GetDevices is not supported");
|
||||
}
|
||||
// The stream was constructed with one device, thus getDevices must only return one
|
||||
ASSERT_EQ(1U, devices.size());
|
||||
AudioDevice device = devices[0].device;
|
||||
ASSERT_TRUE(device == expectedDevice)
|
||||
<< "Expected: " << ::testing::PrintToString(expectedDevice)
|
||||
<< "\n Actual: " << ::testing::PrintToString(device);
|
||||
}
|
||||
|
||||
TEST_IO_STREAM(GetDevices, "Check that the stream device == the one it was opened with",
|
||||
areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
|
||||
: testGetDevices(stream.get(), address.device))
|
||||
|
||||
static void testSetDevices(IStream* stream, const DeviceAddress& address) {
|
||||
DeviceAddress otherAddress = address;
|
||||
otherAddress.device = (address.device & AudioDevice::BIT_IN) == 0 ? AudioDevice::OUT_SPEAKER
|
||||
: AudioDevice::IN_BUILTIN_MIC;
|
||||
EXPECT_OK(stream->setDevices({otherAddress}));
|
||||
|
||||
ASSERT_OK(stream->setDevices({address})); // Go back to the original value
|
||||
}
|
||||
|
||||
TEST_IO_STREAM(SetDevices, "Check that the stream can be rerouted to SPEAKER or BUILTIN_MIC",
|
||||
areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
|
||||
: testSetDevices(stream.get(), address))
|
||||
|
||||
static void checkGetHwAVSync(IDevice* device) {
|
||||
Result res;
|
||||
AudioHwSync sync;
|
||||
ASSERT_OK(device->getHwAvSync(returnIn(res, sync)));
|
||||
if (res == Result::NOT_SUPPORTED) {
|
||||
return doc::partialTest("getHwAvSync is not supported");
|
||||
}
|
||||
ASSERT_OK(res);
|
||||
}
|
||||
TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail", checkGetHwAVSync(device.get()));
|
||||
|
||||
TEST_P(InputStreamTest, updateSinkMetadata) {
|
||||
doc::test("The HAL should not crash on metadata change");
|
||||
|
||||
hidl_enum_range<AudioSource> range;
|
||||
// Test all possible track configuration
|
||||
for (AudioSource source : range) {
|
||||
for (float volume : {0.0, 0.5, 1.0}) {
|
||||
const SinkMetadata metadata = {{{.source = source, .gain = volume}}};
|
||||
ASSERT_OK(stream->updateSinkMetadata(metadata))
|
||||
<< "source=" << toString(source) << ", volume=" << volume;
|
||||
}
|
||||
}
|
||||
|
||||
// Do not test concurrent capture as this is not officially supported
|
||||
|
||||
// Set no metadata as if all stream track had stopped
|
||||
ASSERT_OK(stream->updateSinkMetadata({}));
|
||||
|
||||
// Restore initial
|
||||
ASSERT_OK(stream->updateSinkMetadata(initMetadata));
|
||||
}
|
||||
|
||||
TEST_P(OutputStreamTest, SelectPresentation) {
|
||||
doc::test("Verify that presentation selection does not crash");
|
||||
ASSERT_RESULT(okOrNotSupported, stream->selectPresentation(0, 0));
|
||||
}
|
||||
|
||||
TEST_P(OutputStreamTest, updateSourceMetadata) {
|
||||
doc::test("The HAL should not crash on metadata change");
|
||||
|
||||
hidl_enum_range<AudioUsage> usageRange;
|
||||
hidl_enum_range<AudioContentType> contentRange;
|
||||
// Test all possible track configuration
|
||||
for (auto usage : usageRange) {
|
||||
for (auto content : contentRange) {
|
||||
for (float volume : {0.0, 0.5, 1.0}) {
|
||||
const SourceMetadata metadata = {{{usage, content, volume}}};
|
||||
ASSERT_OK(stream->updateSourceMetadata(metadata))
|
||||
<< "usage=" << toString(usage) << ", content=" << toString(content)
|
||||
<< ", volume=" << volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set many track of different configuration
|
||||
ASSERT_OK(stream->updateSourceMetadata(
|
||||
{{{AudioUsage::MEDIA, AudioContentType::MUSIC, 0.1},
|
||||
{AudioUsage::VOICE_COMMUNICATION, AudioContentType::SPEECH, 1.0},
|
||||
{AudioUsage::ALARM, AudioContentType::SONIFICATION, 0.0},
|
||||
{AudioUsage::ASSISTANT, AudioContentType::UNKNOWN, 0.3}}}));
|
||||
|
||||
// Set no metadata as if all stream track had stopped
|
||||
ASSERT_OK(stream->updateSourceMetadata({}));
|
||||
|
||||
// Restore initial
|
||||
ASSERT_OK(stream->updateSourceMetadata(initMetadata));
|
||||
}
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, setMode) {
|
||||
doc::test("Make sure setMode always succeeds if mode is valid and fails otherwise");
|
||||
// Test Invalid values
|
||||
for (int mode : {-2, -1, int(AudioMode::IN_COMMUNICATION) + 1}) {
|
||||
ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(AudioMode(mode)))
|
||||
<< "mode=" << mode;
|
||||
}
|
||||
// Test valid values
|
||||
for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
|
||||
AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
|
||||
ASSERT_OK(device->setMode(mode)) << "mode=" << toString(mode);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, setBtHfpSampleRate) {
|
||||
doc::test(
|
||||
"Make sure setBtHfpSampleRate either succeeds or "
|
||||
"indicates that it is not supported at all, or that the provided value is invalid");
|
||||
for (auto samplingRate : {8000, 16000, 22050, 24000}) {
|
||||
ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, device->setBtHfpSampleRate(samplingRate));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, setBtHfpVolume) {
|
||||
doc::test(
|
||||
"Make sure setBtHfpVolume is either not supported or "
|
||||
"only succeed if volume is in [0,1]");
|
||||
auto ret = device->setBtHfpVolume(0.0);
|
||||
ASSERT_TRUE(ret.isOk());
|
||||
if (ret == Result::NOT_SUPPORTED) {
|
||||
doc::partialTest("setBtHfpVolume is not supported");
|
||||
return;
|
||||
}
|
||||
testUnitaryGain([](float volume) { return device->setBtHfpVolume(volume); });
|
||||
}
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, setBtScoHeadsetDebugName) {
|
||||
doc::test(
|
||||
"Make sure setBtScoHeadsetDebugName either succeeds or "
|
||||
"indicates that it is not supported");
|
||||
ASSERT_RESULT(okOrNotSupported, device->setBtScoHeadsetDebugName("test"));
|
||||
}
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, updateRotation) {
|
||||
doc::test("Check that the hal can receive the current rotation");
|
||||
for (Rotation rotation : {Rotation::DEG_0, Rotation::DEG_90, Rotation::DEG_180,
|
||||
Rotation::DEG_270, Rotation::DEG_0}) {
|
||||
ASSERT_RESULT(okOrNotSupported, device->updateRotation(rotation));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(BoolAccessorPrimaryHidlTest, setGetBtHfpEnabled) {
|
||||
doc::test("Query and set the BT HFP state");
|
||||
testAccessors<OPTIONAL>("BtHfpEnabled", Initial{false, OPTIONAL}, {true},
|
||||
&IPrimaryDevice::setBtHfpEnabled, &IPrimaryDevice::getBtHfpEnabled);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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 PATH(android/hardware/audio/FILE_VERSION/IStream.h)
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/types.h)
|
||||
#include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
|
||||
#include <hidl/HidlSupport.h>
|
||||
|
||||
using ::android::hardware::hidl_bitfield;
|
||||
using ::android::hardware::hidl_handle;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
|
||||
using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
|
||||
using ::android::hardware::audio::CPP_VERSION::IStream;
|
||||
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
|
||||
using ::android::hardware::audio::CPP_VERSION::Result;
|
||||
|
||||
using namespace ::android::hardware::audio::common::test::utility;
|
||||
|
||||
using Rotation = ::android::hardware::audio::CPP_VERSION::IPrimaryDevice::Rotation;
|
||||
using ::android::hardware::audio::common::CPP_VERSION::AudioContentType;
|
||||
using ::android::hardware::audio::common::CPP_VERSION::AudioUsage;
|
||||
using ::android::hardware::audio::CPP_VERSION::MicrophoneInfo;
|
||||
#if MAJOR_VERSION < 5
|
||||
using ::android::hardware::audio::CPP_VERSION::SinkMetadata;
|
||||
using ::android::hardware::audio::CPP_VERSION::SourceMetadata;
|
||||
#else
|
||||
using ::android::hardware::audio::common::CPP_VERSION::SinkMetadata;
|
||||
using ::android::hardware::audio::common::CPP_VERSION::SourceMetadata;
|
||||
#endif
|
||||
|
||||
struct Parameters {
|
||||
template <class T, class ReturnIn>
|
||||
static auto get(T t, hidl_vec<hidl_string> keys, ReturnIn returnIn) {
|
||||
hidl_vec<ParameterValue> context;
|
||||
return t->getParameters(context, keys, returnIn);
|
||||
}
|
||||
template <class T>
|
||||
static auto set(T t, hidl_vec<ParameterValue> values) {
|
||||
hidl_vec<ParameterValue> context;
|
||||
return t->setParameters(context, values);
|
||||
}
|
||||
};
|
||||
|
||||
struct GetSupported {
|
||||
static auto getFormat(IStream* stream) {
|
||||
auto ret = stream->getFormat();
|
||||
EXPECT_TRUE(ret.isOk());
|
||||
return ret.withDefault({});
|
||||
}
|
||||
static Result sampleRates(IStream* stream, hidl_vec<uint32_t>& rates) {
|
||||
Result res;
|
||||
EXPECT_OK(stream->getSupportedSampleRates(getFormat(stream), returnIn(res, rates)));
|
||||
return res;
|
||||
}
|
||||
|
||||
static Result channelMasks(IStream* stream,
|
||||
hidl_vec<hidl_bitfield<AudioChannelMask>>& channels) {
|
||||
Result res;
|
||||
EXPECT_OK(stream->getSupportedChannelMasks(getFormat(stream), returnIn(res, channels)));
|
||||
return res;
|
||||
}
|
||||
|
||||
static Result formats(IStream* stream, hidl_vec<AudioFormat>& capabilities) {
|
||||
EXPECT_OK(stream->getSupportedFormats(returnIn(capabilities)));
|
||||
// TODO: this should be an optional function
|
||||
return Result::OK;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
auto dump(T t, hidl_handle handle) {
|
||||
return t->debug(handle, {/* options */});
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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 <math.h>
|
||||
|
||||
// pull in all the <= 4.0 tests
|
||||
#include "4.0/AudioPrimaryHidlHalTest.cpp"
|
||||
|
||||
TEST_P(InputStreamTest, SetMicrophoneDirection) {
|
||||
doc::test("Make sure setMicrophoneDirection correctly handles valid & invalid arguments");
|
||||
|
||||
// MicrophoneDirection dir = MicrophoneDirection::FRONT;
|
||||
for (MicrophoneDirection dir : android::hardware::hidl_enum_range<MicrophoneDirection>()) {
|
||||
ASSERT_RESULT(okOrNotSupported, stream->setMicrophoneDirection(dir));
|
||||
}
|
||||
|
||||
// Bogus values
|
||||
for (auto dir : {42, -1, 4}) {
|
||||
ASSERT_RESULT(invalidArgsOrNotSupported,
|
||||
stream->setMicrophoneDirection(MicrophoneDirection(dir)));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(InputStreamTest, SetMicrophoneFieldDimension) {
|
||||
doc::test("Make sure setMicrophoneFieldDimension correctly handles valid & invalid arguments");
|
||||
|
||||
// Valid zoom values -1.0 -> 1.0
|
||||
float incr = 0.1f;
|
||||
for (float val = -1.0f; val <= 1.0; val += incr) {
|
||||
ASSERT_RESULT(okOrNotSupported, stream->setMicrophoneFieldDimension(val));
|
||||
}
|
||||
|
||||
// Bogus values
|
||||
for (float val = 1.0f + incr; val <= 10.0f; val += incr) {
|
||||
ASSERT_RESULT(invalidArgsOrNotSupported, stream->setMicrophoneFieldDimension(val));
|
||||
ASSERT_RESULT(invalidArgsOrNotSupported, stream->setMicrophoneFieldDimension(-val));
|
||||
}
|
||||
// Some extremes
|
||||
ASSERT_RESULT(invalidArgsOrNotSupported, stream->setMicrophoneFieldDimension(NAN));
|
||||
ASSERT_RESULT(invalidArgsOrNotSupported, stream->setMicrophoneFieldDimension(-NAN));
|
||||
ASSERT_RESULT(invalidArgsOrNotSupported, stream->setMicrophoneFieldDimension(INFINITY));
|
||||
ASSERT_RESULT(invalidArgsOrNotSupported, stream->setMicrophoneFieldDimension(-INFINITY));
|
||||
}
|
||||
84
audio/core/all-versions/vts/functional/Android.bp
Normal file
84
audio/core/all-versions/vts/functional/Android.bp
Normal file
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// Copyright (C) 2017 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
cc_defaults {
|
||||
name: "VtsHalAudioTargetTest_defaults",
|
||||
defaults: ["VtsHalTargetTestDefaults"],
|
||||
static_libs: [
|
||||
"android.hardware.audio.common.test.utility",
|
||||
"libaudiopolicycomponents",
|
||||
"libmedia_helper",
|
||||
"libxml2",
|
||||
],
|
||||
shared_libs: [
|
||||
"libfmq",
|
||||
],
|
||||
header_libs: [
|
||||
"android.hardware.audio.common.util@all-versions",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalAudioV2_0TargetTest",
|
||||
defaults: ["VtsHalAudioTargetTest_defaults"],
|
||||
srcs: [
|
||||
"2.0/AudioPrimaryHidlHalTest.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.audio@2.0",
|
||||
"android.hardware.audio.common@2.0",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=2",
|
||||
"-DMINOR_VERSION=0",
|
||||
"-include common/all-versions/VersionMacro.h",
|
||||
]
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalAudioV4_0TargetTest",
|
||||
defaults: ["VtsHalAudioTargetTest_defaults"],
|
||||
srcs: [
|
||||
"4.0/AudioPrimaryHidlHalTest.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.audio@4.0",
|
||||
"android.hardware.audio.common@4.0",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=4",
|
||||
"-DMINOR_VERSION=0",
|
||||
"-include common/all-versions/VersionMacro.h",
|
||||
]
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalAudioV5_0TargetTest",
|
||||
defaults: ["VtsHalAudioTargetTest_defaults"],
|
||||
srcs: [
|
||||
"5.0/AudioPrimaryHidlHalTest.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"android.hardware.audio@5.0",
|
||||
"android.hardware.audio.common@5.0",
|
||||
],
|
||||
cflags: [
|
||||
"-DMAJOR_VERSION=5",
|
||||
"-DMINOR_VERSION=0",
|
||||
"-include common/all-versions/VersionMacro.h",
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "VtsHalAudioV2_0TargetTest"
|
||||
#define LOG_TAG "VtsHalAudioVTargetTest"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
@@ -22,71 +22,86 @@
|
||||
#include <cstdio>
|
||||
#include <initializer_list>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <hwbinder/IPCThreadState.h>
|
||||
|
||||
#include <VtsHalHidlTargetTestBase.h>
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <android/hardware/audio/2.0/IDevice.h>
|
||||
#include <android/hardware/audio/2.0/IDevicesFactory.h>
|
||||
#include <android/hardware/audio/2.0/IPrimaryDevice.h>
|
||||
#include <android/hardware/audio/2.0/types.h>
|
||||
#include <android/hardware/audio/common/2.0/types.h>
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/IDevice.h)
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h)
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/IPrimaryDevice.h)
|
||||
#include PATH(android/hardware/audio/FILE_VERSION/types.h)
|
||||
#include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
|
||||
|
||||
#include <Serializer.h>
|
||||
#include <fmq/EventFlag.h>
|
||||
#include <fmq/MessageQueue.h>
|
||||
|
||||
#include <common/all-versions/VersionUtils.h>
|
||||
|
||||
#include "utility/AssertOk.h"
|
||||
#include "utility/Documentation.h"
|
||||
#include "utility/EnvironmentTearDown.h"
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include "utility/PrettyPrintAudioTypes.h"
|
||||
#include "utility/ReturnIn.h"
|
||||
#include "utility/ValidateXml.h"
|
||||
|
||||
/** Provide version specific functions that are used in the generic tests */
|
||||
#if MAJOR_VERSION == 2
|
||||
#include "2.0/AudioPrimaryHidlHalUtils.h"
|
||||
#elif MAJOR_VERSION >= 4
|
||||
#include "4.0/AudioPrimaryHidlHalUtils.h"
|
||||
#endif
|
||||
|
||||
using std::initializer_list;
|
||||
using std::list;
|
||||
using std::string;
|
||||
using std::to_string;
|
||||
using std::vector;
|
||||
|
||||
using ::android::AudioPolicyConfig;
|
||||
using ::android::HwModule;
|
||||
using ::android::NO_INIT;
|
||||
using ::android::OK;
|
||||
using ::android::sp;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::status_t;
|
||||
using ::android::hardware::EventFlag;
|
||||
using ::android::hardware::hidl_bitfield;
|
||||
using ::android::hardware::hidl_enum_range;
|
||||
using ::android::hardware::hidl_handle;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::IPCThreadState;
|
||||
using ::android::hardware::kSynchronizedReadWrite;
|
||||
using ::android::hardware::MessageQueue;
|
||||
using ::android::hardware::MQDescriptorSync;
|
||||
using ::android::hardware::audio::V2_0::AudioDrain;
|
||||
using ::android::hardware::audio::V2_0::DeviceAddress;
|
||||
using ::android::hardware::audio::V2_0::IDevice;
|
||||
using ::android::hardware::audio::V2_0::IPrimaryDevice;
|
||||
using TtyMode = ::android::hardware::audio::V2_0::IPrimaryDevice::TtyMode;
|
||||
using ::android::hardware::audio::V2_0::IDevicesFactory;
|
||||
using ::android::hardware::audio::V2_0::IStream;
|
||||
using ::android::hardware::audio::V2_0::IStreamIn;
|
||||
using ::android::hardware::audio::V2_0::TimeSpec;
|
||||
using ReadParameters = ::android::hardware::audio::V2_0::IStreamIn::ReadParameters;
|
||||
using ReadStatus = ::android::hardware::audio::V2_0::IStreamIn::ReadStatus;
|
||||
using ::android::hardware::audio::V2_0::IStreamOut;
|
||||
using ::android::hardware::audio::V2_0::IStreamOutCallback;
|
||||
using ::android::hardware::audio::V2_0::MmapBufferInfo;
|
||||
using ::android::hardware::audio::V2_0::MmapPosition;
|
||||
using ::android::hardware::audio::V2_0::ParameterValue;
|
||||
using ::android::hardware::audio::V2_0::Result;
|
||||
using ::android::hardware::audio::common::V2_0::AudioChannelMask;
|
||||
using ::android::hardware::audio::common::V2_0::AudioConfig;
|
||||
using ::android::hardware::audio::common::V2_0::AudioDevice;
|
||||
using ::android::hardware::audio::common::V2_0::AudioFormat;
|
||||
using ::android::hardware::audio::common::V2_0::AudioHandleConsts;
|
||||
using ::android::hardware::audio::common::V2_0::AudioInputFlag;
|
||||
using ::android::hardware::audio::common::V2_0::AudioIoHandle;
|
||||
using ::android::hardware::audio::common::V2_0::AudioMode;
|
||||
using ::android::hardware::audio::common::V2_0::AudioOffloadInfo;
|
||||
using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
|
||||
using ::android::hardware::audio::common::V2_0::AudioSource;
|
||||
using ::android::hardware::audio::common::V2_0::ThreadInfo;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::audio::common::utils::mkEnumBitfield;
|
||||
|
||||
using namespace ::android::hardware::audio::common::CPP_VERSION;
|
||||
using namespace ::android::hardware::audio::common::test::utility;
|
||||
using namespace ::android::hardware::audio::CPP_VERSION;
|
||||
|
||||
// Typical accepted results from interface methods
|
||||
static auto okOrNotSupported = {Result::OK, Result::NOT_SUPPORTED};
|
||||
static auto okOrNotSupportedOrInvalidArgs = {Result::OK, Result::NOT_SUPPORTED,
|
||||
Result::INVALID_ARGUMENTS};
|
||||
static auto okOrInvalidStateOrNotSupported = {Result::OK, Result::INVALID_STATE,
|
||||
Result::NOT_SUPPORTED};
|
||||
static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED};
|
||||
static auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////// Environment /////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class AudioHidlTestEnvironment : public ::Environment {
|
||||
public:
|
||||
@@ -102,12 +117,103 @@ class HidlTest : public ::testing::VtsHalHidlTargetTestBase {
|
||||
Result res;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////// Audio policy configuration ////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static const std::vector<const char*> kConfigLocations = {"/odm/etc", "/vendor/etc", "/system/etc"};
|
||||
static constexpr char kConfigFileName[] = "audio_policy_configuration.xml";
|
||||
|
||||
// Stringify the argument.
|
||||
#define QUOTE(x) #x
|
||||
#define STRINGIFY(x) QUOTE(x)
|
||||
|
||||
TEST(CheckConfig, audioPolicyConfigurationValidation) {
|
||||
RecordProperty("description",
|
||||
"Verify that the audio policy configuration file "
|
||||
"is valid according to the schema");
|
||||
|
||||
const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd";
|
||||
EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(kConfigFileName, kConfigLocations, xsd);
|
||||
}
|
||||
|
||||
struct PolicyConfigData {
|
||||
android::HwModuleCollection hwModules;
|
||||
android::DeviceVector availableOutputDevices;
|
||||
android::DeviceVector availableInputDevices;
|
||||
sp<android::DeviceDescriptor> defaultOutputDevice;
|
||||
};
|
||||
|
||||
class PolicyConfig : private PolicyConfigData, public AudioPolicyConfig {
|
||||
public:
|
||||
PolicyConfig()
|
||||
: AudioPolicyConfig(hwModules, availableOutputDevices, availableInputDevices,
|
||||
defaultOutputDevice) {
|
||||
for (const char* location : kConfigLocations) {
|
||||
std::string path = std::string(location) + '/' + kConfigFileName;
|
||||
if (access(path.c_str(), F_OK) == 0) {
|
||||
mFilePath = path;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mStatus = android::deserializeAudioPolicyFile(mFilePath.c_str(), this);
|
||||
if (mStatus == OK) {
|
||||
mPrimaryModule = getHwModules().getModuleFromName("primary");
|
||||
}
|
||||
}
|
||||
status_t getStatus() const { return mStatus; }
|
||||
std::string getError() const {
|
||||
if (mFilePath.empty()) {
|
||||
return std::string{"Could not find "} + kConfigFileName +
|
||||
" file in: " + testing::PrintToString(kConfigLocations);
|
||||
} else {
|
||||
return "Invalid config file: " + mFilePath;
|
||||
}
|
||||
}
|
||||
const std::string& getFilePath() const { return mFilePath; }
|
||||
sp<const HwModule> getPrimaryModule() const { return mPrimaryModule; }
|
||||
|
||||
private:
|
||||
status_t mStatus = NO_INIT;
|
||||
std::string mFilePath;
|
||||
sp<HwModule> mPrimaryModule = nullptr;
|
||||
};
|
||||
|
||||
// Cached policy config after parsing for faster test startup
|
||||
const PolicyConfig& getCachedPolicyConfig() {
|
||||
static std::unique_ptr<PolicyConfig> policyConfig = [] {
|
||||
auto config = std::make_unique<PolicyConfig>();
|
||||
environment->registerTearDown([] { policyConfig.reset(); });
|
||||
return config;
|
||||
}();
|
||||
return *policyConfig;
|
||||
}
|
||||
|
||||
class AudioPolicyConfigTest : public HidlTest {
|
||||
public:
|
||||
void SetUp() override {
|
||||
ASSERT_NO_FATAL_FAILURE(HidlTest::SetUp()); // setup base
|
||||
|
||||
auto& policyConfig = getCachedPolicyConfig();
|
||||
ASSERT_EQ(0, policyConfig.getStatus()) << policyConfig.getError();
|
||||
|
||||
mPrimaryConfig = policyConfig.getPrimaryModule();
|
||||
ASSERT_TRUE(mPrimaryConfig) << "Could not find primary module in configuration file: "
|
||||
<< policyConfig.getFilePath();
|
||||
}
|
||||
sp<const HwModule> mPrimaryConfig = nullptr;
|
||||
};
|
||||
|
||||
TEST_F(AudioPolicyConfigTest, LoadAudioPolicyXMLConfiguration) {
|
||||
doc::test("Test parsing audio_policy_configuration.xml (called in SetUp)");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// getService audio_devices_factory //////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Test all audio devices
|
||||
class AudioHidlTest : public HidlTest {
|
||||
class AudioHidlTest : public AudioPolicyConfigTest {
|
||||
public:
|
||||
void SetUp() override {
|
||||
ASSERT_NO_FATAL_FAILURE(HidlTest::SetUp()); // setup base
|
||||
@@ -127,15 +233,20 @@ class AudioHidlTest : public HidlTest {
|
||||
sp<IDevicesFactory> AudioHidlTest::devicesFactory;
|
||||
|
||||
TEST_F(AudioHidlTest, GetAudioDevicesFactoryService) {
|
||||
doc::test("test the getService (called in SetUp)");
|
||||
doc::test("Test the getService (called in SetUp)");
|
||||
}
|
||||
|
||||
TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) {
|
||||
doc::test("test passing an invalid parameter to openDevice");
|
||||
IDevicesFactory::Result result;
|
||||
doc::test("Test passing an invalid parameter to openDevice");
|
||||
Result result;
|
||||
sp<IDevice> device;
|
||||
ASSERT_OK(devicesFactory->openDevice(IDevicesFactory::Device(-1), returnIn(result, device)));
|
||||
ASSERT_EQ(IDevicesFactory::Result::INVALID_ARGUMENTS, result);
|
||||
#if MAJOR_VERSION == 2
|
||||
auto invalidDevice = IDevicesFactory::Device(-1);
|
||||
#elif MAJOR_VERSION >= 4
|
||||
auto invalidDevice = "Non existing device";
|
||||
#endif
|
||||
ASSERT_OK(devicesFactory->openDevice(invalidDevice, returnIn(result, device)));
|
||||
ASSERT_EQ(Result::INVALID_ARGUMENTS, result);
|
||||
ASSERT_TRUE(device == nullptr);
|
||||
}
|
||||
|
||||
@@ -151,22 +262,32 @@ class AudioPrimaryHidlTest : public AudioHidlTest {
|
||||
ASSERT_NO_FATAL_FAILURE(AudioHidlTest::SetUp()); // setup base
|
||||
|
||||
if (device == nullptr) {
|
||||
IDevicesFactory::Result result;
|
||||
sp<IDevice> baseDevice;
|
||||
ASSERT_OK(devicesFactory->openDevice(IDevicesFactory::Device::PRIMARY,
|
||||
returnIn(result, baseDevice)));
|
||||
ASSERT_OK(result);
|
||||
ASSERT_TRUE(baseDevice != nullptr);
|
||||
|
||||
environment->registerTearDown([] { device.clear(); });
|
||||
device = IPrimaryDevice::castFrom(baseDevice);
|
||||
initPrimaryDevice();
|
||||
ASSERT_TRUE(device != nullptr);
|
||||
environment->registerTearDown([] { device.clear(); });
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
// Cache the device opening to speed up each test by ~0.5s
|
||||
static sp<IPrimaryDevice> device;
|
||||
|
||||
private:
|
||||
void initPrimaryDevice() {
|
||||
Result result;
|
||||
#if MAJOR_VERSION == 2
|
||||
sp<IDevice> baseDevice;
|
||||
ASSERT_OK(devicesFactory->openDevice(IDevicesFactory::Device::PRIMARY,
|
||||
returnIn(result, baseDevice)));
|
||||
ASSERT_OK(result);
|
||||
ASSERT_TRUE(baseDevice != nullptr);
|
||||
|
||||
device = IPrimaryDevice::castFrom(baseDevice);
|
||||
#elif MAJOR_VERSION >= 4
|
||||
ASSERT_OK(devicesFactory->openPrimaryDevice(returnIn(result, device)));
|
||||
ASSERT_OK(result);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
sp<IPrimaryDevice> AudioPrimaryHidlTest::device;
|
||||
|
||||
@@ -186,53 +307,59 @@ TEST_F(AudioPrimaryHidlTest, Init) {
|
||||
template <class Property>
|
||||
class AccessorPrimaryHidlTest : public AudioPrimaryHidlTest {
|
||||
protected:
|
||||
/** Test a property getter and setter. */
|
||||
template <class Getter, class Setter>
|
||||
void testAccessors(const string& propertyName, const vector<Property>& valuesToTest,
|
||||
Setter setter, Getter getter, const vector<Property>& invalidValues = {}) {
|
||||
Property initialValue; // Save initial value to restore it at the end
|
||||
// of the test
|
||||
ASSERT_OK((device.get()->*getter)(returnIn(res, initialValue)));
|
||||
ASSERT_OK(res);
|
||||
enum Optionality { REQUIRED, OPTIONAL };
|
||||
struct Initial { // Initial property value
|
||||
Initial(Property value, Optionality check = REQUIRED) : value(value), check(check) {}
|
||||
Property value;
|
||||
Optionality check; // If this initial value should be checked
|
||||
};
|
||||
/** Test a property getter and setter.
|
||||
* The getter and/or the setter may return NOT_SUPPORTED if optionality == OPTIONAL.
|
||||
*/
|
||||
template <Optionality optionality = REQUIRED, class Getter, class Setter>
|
||||
void testAccessors(const string& propertyName, const Initial expectedInitial,
|
||||
list<Property> valuesToTest, Setter setter, Getter getter,
|
||||
const vector<Property>& invalidValues = {}) {
|
||||
const auto expectedResults = {Result::OK,
|
||||
optionality == OPTIONAL ? Result::NOT_SUPPORTED : Result::OK};
|
||||
|
||||
Property initialValue = expectedInitial.value;
|
||||
ASSERT_OK((device.get()->*getter)(returnIn(res, initialValue)));
|
||||
ASSERT_RESULT(expectedResults, res);
|
||||
if (res == Result::OK && expectedInitial.check == REQUIRED) {
|
||||
EXPECT_EQ(expectedInitial.value, initialValue);
|
||||
}
|
||||
|
||||
valuesToTest.push_front(expectedInitial.value);
|
||||
valuesToTest.push_back(initialValue);
|
||||
for (Property setValue : valuesToTest) {
|
||||
SCOPED_TRACE("Test " + propertyName + " getter and setter for " +
|
||||
testing::PrintToString(setValue));
|
||||
ASSERT_OK((device.get()->*setter)(setValue));
|
||||
auto ret = (device.get()->*setter)(setValue);
|
||||
ASSERT_RESULT(expectedResults, ret);
|
||||
if (ret == Result::NOT_SUPPORTED) {
|
||||
doc::partialTest(propertyName + " setter is not supported");
|
||||
break;
|
||||
}
|
||||
Property getValue;
|
||||
// Make sure the getter returns the same value just set
|
||||
ASSERT_OK((device.get()->*getter)(returnIn(res, getValue)));
|
||||
ASSERT_OK(res);
|
||||
ASSERT_RESULT(expectedResults, res);
|
||||
if (res == Result::NOT_SUPPORTED) {
|
||||
doc::partialTest(propertyName + " getter is not supported");
|
||||
continue;
|
||||
}
|
||||
EXPECT_EQ(setValue, getValue);
|
||||
}
|
||||
|
||||
for (Property invalidValue : invalidValues) {
|
||||
SCOPED_TRACE("Try to set " + propertyName + " with the invalid value " +
|
||||
testing::PrintToString(invalidValue));
|
||||
EXPECT_RESULT(Result::INVALID_ARGUMENTS, (device.get()->*setter)(invalidValue));
|
||||
EXPECT_RESULT(invalidArgsOrNotSupported, (device.get()->*setter)(invalidValue));
|
||||
}
|
||||
|
||||
ASSERT_OK((device.get()->*setter)(initialValue)); // restore initial value
|
||||
}
|
||||
|
||||
/** Test the getter and setter of an optional feature. */
|
||||
template <class Getter, class Setter>
|
||||
void testOptionalAccessors(const string& propertyName, const vector<Property>& valuesToTest,
|
||||
Setter setter, Getter getter,
|
||||
const vector<Property>& invalidValues = {}) {
|
||||
doc::test("Test the optional " + propertyName + " getters and setter");
|
||||
{
|
||||
SCOPED_TRACE("Test feature support by calling the getter");
|
||||
Property initialValue;
|
||||
ASSERT_OK((device.get()->*getter)(returnIn(res, initialValue)));
|
||||
if (res == Result::NOT_SUPPORTED) {
|
||||
doc::partialTest(propertyName + " getter is not supported");
|
||||
return;
|
||||
}
|
||||
ASSERT_OK(res); // If it is supported it must succeed
|
||||
}
|
||||
// The feature is supported, test it
|
||||
testAccessors(propertyName, valuesToTest, setter, getter, invalidValues);
|
||||
// Restore initial value
|
||||
EXPECT_RESULT(expectedResults, (device.get()->*setter)(initialValue));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -240,24 +367,22 @@ using BoolAccessorPrimaryHidlTest = AccessorPrimaryHidlTest<bool>;
|
||||
|
||||
TEST_F(BoolAccessorPrimaryHidlTest, MicMuteTest) {
|
||||
doc::test("Check that the mic can be muted and unmuted");
|
||||
testAccessors("mic mute", {true, false, true}, &IDevice::setMicMute, &IDevice::getMicMute);
|
||||
testAccessors("mic mute", Initial{false}, {true}, &IDevice::setMicMute, &IDevice::getMicMute);
|
||||
// TODO: check that the mic is really muted (all sample are 0)
|
||||
}
|
||||
|
||||
TEST_F(BoolAccessorPrimaryHidlTest, MasterMuteTest) {
|
||||
doc::test(
|
||||
"If master mute is supported, try to mute and unmute the master "
|
||||
"output");
|
||||
testOptionalAccessors("master mute", {true, false, true}, &IDevice::setMasterMute,
|
||||
&IDevice::getMasterMute);
|
||||
doc::test("If master mute is supported, try to mute and unmute the master output");
|
||||
testAccessors<OPTIONAL>("master mute", Initial{false}, {true}, &IDevice::setMasterMute,
|
||||
&IDevice::getMasterMute);
|
||||
// TODO: check that the master volume is really muted
|
||||
}
|
||||
|
||||
using FloatAccessorPrimaryHidlTest = AccessorPrimaryHidlTest<float>;
|
||||
TEST_F(FloatAccessorPrimaryHidlTest, MasterVolumeTest) {
|
||||
doc::test("Test the master volume if supported");
|
||||
testOptionalAccessors(
|
||||
"master volume", {0, 0.5, 1}, &IDevice::setMasterVolume, &IDevice::getMasterVolume,
|
||||
testAccessors<OPTIONAL>(
|
||||
"master volume", Initial{1}, {0, 0.5}, &IDevice::setMasterVolume, &IDevice::getMasterVolume,
|
||||
{-0.1, 1.1, NAN, INFINITY, -INFINITY, 1 + std::numeric_limits<float>::epsilon()});
|
||||
// TODO: check that the master volume is really changed
|
||||
}
|
||||
@@ -295,6 +420,21 @@ TEST_F(AudioPatchPrimaryHidlTest, AudioPatches) {
|
||||
|
||||
class AudioConfigPrimaryTest : public AudioPatchPrimaryHidlTest {
|
||||
public:
|
||||
// for retro compatibility only test the primary device IN_BUILTIN_MIC
|
||||
// FIXME: in the next audio HAL version, test all available devices
|
||||
static bool primaryHasMic() {
|
||||
auto& policyConfig = getCachedPolicyConfig();
|
||||
if (policyConfig.getStatus() != OK || policyConfig.getPrimaryModule() == nullptr) {
|
||||
return true; // Could not get the information, run all tests
|
||||
}
|
||||
auto getMic = [](auto& devs) { return devs.getDevice(
|
||||
AUDIO_DEVICE_IN_BUILTIN_MIC, {}, AUDIO_FORMAT_DEFAULT); };
|
||||
auto primaryMic = getMic(policyConfig.getPrimaryModule()->getDeclaredDevices());
|
||||
auto availableMic = getMic(policyConfig.getAvailableInputDevices());
|
||||
|
||||
return primaryMic != nullptr && primaryMic->equals(availableMic);
|
||||
}
|
||||
|
||||
// Cache result ?
|
||||
static const vector<AudioConfig> getRequiredSupportPlaybackAudioConfig() {
|
||||
return combineAudioConfig({AudioChannelMask::OUT_STEREO, AudioChannelMask::OUT_MONO},
|
||||
@@ -314,10 +454,12 @@ class AudioConfigPrimaryTest : public AudioPatchPrimaryHidlTest {
|
||||
}
|
||||
|
||||
static const vector<AudioConfig> getRequiredSupportCaptureAudioConfig() {
|
||||
if (!primaryHasMic()) return {};
|
||||
return combineAudioConfig({AudioChannelMask::IN_MONO}, {8000, 11025, 16000, 44100},
|
||||
{AudioFormat::PCM_16_BIT});
|
||||
}
|
||||
static const vector<AudioConfig> getRecommendedSupportCaptureAudioConfig() {
|
||||
if (!primaryHasMic()) return {};
|
||||
return combineAudioConfig({AudioChannelMask::IN_STEREO}, {22050, 48000},
|
||||
{AudioFormat::PCM_16_BIT});
|
||||
}
|
||||
@@ -337,7 +479,7 @@ class AudioConfigPrimaryTest : public AudioPatchPrimaryHidlTest {
|
||||
for (auto format : formats) {
|
||||
AudioConfig config{};
|
||||
// leave offloadInfo to 0
|
||||
config.channelMask = channelMask;
|
||||
config.channelMask = mkEnumBitfield(channelMask);
|
||||
config.sampleRateHz = sampleRate;
|
||||
config.format = format;
|
||||
// FIXME: leave frameCount to 0 ?
|
||||
@@ -358,10 +500,10 @@ static string generateTestName(const testing::TestParamInfo<AudioConfig>& info)
|
||||
const AudioConfig& config = info.param;
|
||||
return to_string(info.index) + "__" + to_string(config.sampleRateHz) + "_" +
|
||||
// "MONO" is more clear than "FRONT_LEFT"
|
||||
((config.channelMask == AudioChannelMask::OUT_MONO ||
|
||||
config.channelMask == AudioChannelMask::IN_MONO)
|
||||
((config.channelMask == mkEnumBitfield(AudioChannelMask::OUT_MONO) ||
|
||||
config.channelMask == mkEnumBitfield(AudioChannelMask::IN_MONO))
|
||||
? "MONO"
|
||||
: toString(config.channelMask));
|
||||
: ::testing::PrintToString(config.channelMask));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -433,11 +575,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
TEST_F(AudioPrimaryHidlTest, setScreenState) {
|
||||
doc::test("Check that the hal can receive the screen state");
|
||||
for (bool turnedOn : {false, true, true, false, false}) {
|
||||
auto ret = device->setScreenState(turnedOn);
|
||||
ASSERT_IS_OK(ret);
|
||||
Result result = ret;
|
||||
auto okOrNotSupported = {Result::OK, Result::NOT_SUPPORTED};
|
||||
ASSERT_RESULT(okOrNotSupported, result);
|
||||
ASSERT_RESULT(okOrNotSupported, device->setScreenState(turnedOn));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,12 +585,13 @@ TEST_F(AudioPrimaryHidlTest, setScreenState) {
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, getParameters) {
|
||||
doc::test("Check that the hal can set and get parameters");
|
||||
hidl_vec<ParameterValue> context;
|
||||
hidl_vec<hidl_string> keys;
|
||||
hidl_vec<ParameterValue> values;
|
||||
ASSERT_OK(device->getParameters(keys, returnIn(res, values)));
|
||||
ASSERT_OK(device->setParameters(values));
|
||||
ASSERT_OK(Parameters::get(device, keys, returnIn(res, values)));
|
||||
ASSERT_OK(Parameters::set(device, values));
|
||||
values.resize(0);
|
||||
ASSERT_OK(device->setParameters(values));
|
||||
ASSERT_OK(Parameters::set(device, values));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -495,12 +634,12 @@ static void testDebugDump(DebugDump debugDump) {
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, DebugDump) {
|
||||
doc::test("Check that the hal can dump its state without error");
|
||||
testDebugDump([](const auto& handle) { return device->debugDump(handle); });
|
||||
testDebugDump([](const auto& handle) { return dump(device, handle); });
|
||||
}
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, DebugDumpInvalidArguments) {
|
||||
doc::test("Check that the hal dump doesn't crash on invalid arguments");
|
||||
ASSERT_OK(device->debugDump(hidl_handle()));
|
||||
ASSERT_OK(dump(device, hidl_handle()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -569,13 +708,26 @@ class OutputStreamTest : public OpenStreamTest<IStreamOut> {
|
||||
ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base
|
||||
address.device = AudioDevice::OUT_DEFAULT;
|
||||
const AudioConfig& config = GetParam();
|
||||
AudioOutputFlag flags = AudioOutputFlag::NONE; // TODO: test all flag combination
|
||||
// TODO: test all flag combination
|
||||
auto flags = mkEnumBitfield(AudioOutputFlag::NONE);
|
||||
testOpen(
|
||||
[&](AudioIoHandle handle, AudioConfig config, auto cb) {
|
||||
#if MAJOR_VERSION == 2
|
||||
return device->openOutputStream(handle, address, config, flags, cb);
|
||||
#elif MAJOR_VERSION >= 4
|
||||
return device->openOutputStream(handle, address, config, flags, initMetadata, cb);
|
||||
#endif
|
||||
},
|
||||
config);
|
||||
}
|
||||
#if MAJOR_VERSION >= 4
|
||||
|
||||
protected:
|
||||
const SourceMetadata initMetadata = {
|
||||
{ { AudioUsage::MEDIA,
|
||||
AudioContentType::MUSIC,
|
||||
1 /* gain */ } }};
|
||||
#endif
|
||||
};
|
||||
TEST_P(OutputStreamTest, OpenOutputStreamTest) {
|
||||
doc::test(
|
||||
@@ -604,14 +756,21 @@ class InputStreamTest : public OpenStreamTest<IStreamIn> {
|
||||
ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base
|
||||
address.device = AudioDevice::IN_DEFAULT;
|
||||
const AudioConfig& config = GetParam();
|
||||
AudioInputFlag flags = AudioInputFlag::NONE; // TODO: test all flag combination
|
||||
AudioSource source = AudioSource::DEFAULT; // TODO: test all flag combination
|
||||
// TODO: test all supported flags and source
|
||||
auto flags = mkEnumBitfield(AudioInputFlag::NONE);
|
||||
testOpen(
|
||||
[&](AudioIoHandle handle, AudioConfig config, auto cb) {
|
||||
return device->openInputStream(handle, address, config, flags, source, cb);
|
||||
return device->openInputStream(handle, address, config, flags, initMetadata, cb);
|
||||
},
|
||||
config);
|
||||
}
|
||||
|
||||
protected:
|
||||
#if MAJOR_VERSION == 2
|
||||
const AudioSource initMetadata = AudioSource::DEFAULT;
|
||||
#elif MAJOR_VERSION >= 4
|
||||
const SinkMetadata initMetadata = {{{.source = AudioSource::DEFAULT, .gain = 1}}};
|
||||
#endif
|
||||
};
|
||||
|
||||
TEST_P(InputStreamTest, OpenInputStreamTest) {
|
||||
@@ -682,27 +841,26 @@ TEST_IO_STREAM(GetBufferSize, "Check that the stream buffer size== the one it wa
|
||||
|
||||
template <class Property, class CapabilityGetter>
|
||||
static void testCapabilityGetter(const string& name, IStream* stream,
|
||||
CapabilityGetter capablityGetter,
|
||||
CapabilityGetter capabilityGetter,
|
||||
Return<Property> (IStream::*getter)(),
|
||||
Return<Result> (IStream::*setter)(Property),
|
||||
bool currentMustBeSupported = true) {
|
||||
hidl_vec<Property> capabilities;
|
||||
ASSERT_OK((stream->*capablityGetter)(returnIn(capabilities)));
|
||||
if (capabilities.size() == 0) {
|
||||
// The default hal should probably return a NOT_SUPPORTED if the hal
|
||||
// does not expose
|
||||
// capability retrieval. For now it returns an empty list if not
|
||||
// implemented
|
||||
auto ret = capabilityGetter(stream, capabilities);
|
||||
ASSERT_RESULT(okOrNotSupported, ret);
|
||||
bool notSupported = ret == Result::NOT_SUPPORTED;
|
||||
if (notSupported) {
|
||||
doc::partialTest(name + " is not supported");
|
||||
return;
|
||||
};
|
||||
|
||||
if (currentMustBeSupported) {
|
||||
ASSERT_NE(0U, capabilities.size()) << name << " must not return an empty list";
|
||||
Property currentValue = extract((stream->*getter)());
|
||||
EXPECT_NE(std::find(capabilities.begin(), capabilities.end(), currentValue),
|
||||
capabilities.end())
|
||||
<< "current " << name << " is not in the list of the supported ones "
|
||||
<< toString(capabilities);
|
||||
EXPECT_TRUE(std::find(capabilities.begin(), capabilities.end(), currentValue) !=
|
||||
capabilities.end())
|
||||
<< "value returned by " << name << "() = " << testing::PrintToString(currentValue)
|
||||
<< " is not in the list of the supported ones " << toString(capabilities);
|
||||
}
|
||||
|
||||
// Check that all declared supported values are indeed supported
|
||||
@@ -720,7 +878,7 @@ static void testCapabilityGetter(const string& name, IStream* stream,
|
||||
|
||||
TEST_IO_STREAM(SupportedSampleRate, "Check that the stream sample rate is declared as supported",
|
||||
testCapabilityGetter("getSupportedSampleRate", stream.get(),
|
||||
&IStream::getSupportedSampleRates, &IStream::getSampleRate,
|
||||
&GetSupported::sampleRates, &IStream::getSampleRate,
|
||||
&IStream::setSampleRate,
|
||||
// getSupportedSampleRate returns the native sampling rates,
|
||||
// (the sampling rates that can be played without resampling)
|
||||
@@ -729,46 +887,16 @@ TEST_IO_STREAM(SupportedSampleRate, "Check that the stream sample rate is declar
|
||||
|
||||
TEST_IO_STREAM(SupportedChannelMask, "Check that the stream channel mask is declared as supported",
|
||||
testCapabilityGetter("getSupportedChannelMask", stream.get(),
|
||||
&IStream::getSupportedChannelMasks, &IStream::getChannelMask,
|
||||
&GetSupported::channelMasks, &IStream::getChannelMask,
|
||||
&IStream::setChannelMask))
|
||||
|
||||
TEST_IO_STREAM(SupportedFormat, "Check that the stream format is declared as supported",
|
||||
testCapabilityGetter("getSupportedFormat", stream.get(),
|
||||
&IStream::getSupportedFormats, &IStream::getFormat,
|
||||
&IStream::setFormat))
|
||||
|
||||
static void testGetDevice(IStream* stream, AudioDevice expectedDevice) {
|
||||
// Unfortunately the interface does not allow the implementation to return
|
||||
// NOT_SUPPORTED
|
||||
// Thus allow NONE as signaling that the call is not supported.
|
||||
auto ret = stream->getDevice();
|
||||
ASSERT_IS_OK(ret);
|
||||
AudioDevice device = ret;
|
||||
ASSERT_TRUE(device == expectedDevice || device == AudioDevice::NONE)
|
||||
<< "Expected: " << ::testing::PrintToString(expectedDevice)
|
||||
<< "\n Actual: " << ::testing::PrintToString(device);
|
||||
}
|
||||
|
||||
TEST_IO_STREAM(GetDevice, "Check that the stream device == the one it was opened with",
|
||||
areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
|
||||
: testGetDevice(stream.get(), address.device))
|
||||
|
||||
static void testSetDevice(IStream* stream, const DeviceAddress& address) {
|
||||
DeviceAddress otherAddress = address;
|
||||
otherAddress.device = (address.device & AudioDevice::BIT_IN) == 0 ? AudioDevice::OUT_SPEAKER
|
||||
: AudioDevice::IN_BUILTIN_MIC;
|
||||
EXPECT_OK(stream->setDevice(otherAddress));
|
||||
|
||||
ASSERT_OK(stream->setDevice(address)); // Go back to the original value
|
||||
}
|
||||
|
||||
TEST_IO_STREAM(SetDevice, "Check that the stream can be rerouted to SPEAKER or BUILTIN_MIC",
|
||||
areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
|
||||
: testSetDevice(stream.get(), address))
|
||||
testCapabilityGetter("getSupportedFormat", stream.get(), &GetSupported::formats,
|
||||
&IStream::getFormat, &IStream::setFormat))
|
||||
|
||||
static void testGetAudioProperties(IStream* stream, AudioConfig expectedConfig) {
|
||||
uint32_t sampleRateHz;
|
||||
AudioChannelMask mask;
|
||||
auto mask = mkEnumBitfield<AudioChannelMask>({});
|
||||
AudioFormat format;
|
||||
|
||||
stream->getAudioProperties(returnIn(sampleRateHz, mask, format));
|
||||
@@ -784,33 +912,14 @@ TEST_IO_STREAM(GetAudioProperties,
|
||||
"Check that the stream audio properties == the ones it was opened with",
|
||||
testGetAudioProperties(stream.get(), audioConfig))
|
||||
|
||||
static void testConnectedState(IStream* stream) {
|
||||
DeviceAddress address = {};
|
||||
using AD = AudioDevice;
|
||||
for (auto device : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) {
|
||||
address.device = device;
|
||||
|
||||
ASSERT_OK(stream->setConnectedState(address, true));
|
||||
ASSERT_OK(stream->setConnectedState(address, false));
|
||||
}
|
||||
}
|
||||
TEST_IO_STREAM(SetConnectedState,
|
||||
"Check that the stream can be notified of device connection and "
|
||||
"deconnection",
|
||||
testConnectedState(stream.get()))
|
||||
|
||||
static auto invalidArgsOrNotSupportedOrOK = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED,
|
||||
Result::OK};
|
||||
TEST_IO_STREAM(SetHwAvSync, "Try to set hardware sync to an invalid value",
|
||||
ASSERT_RESULT(invalidArgsOrNotSupportedOrOK, stream->setHwAvSync(666)))
|
||||
|
||||
TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail", ASSERT_IS_OK(device->getHwAvSync()));
|
||||
ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, stream->setHwAvSync(666)))
|
||||
|
||||
static void checkGetNoParameter(IStream* stream, hidl_vec<hidl_string> keys,
|
||||
initializer_list<Result> expectedResults) {
|
||||
hidl_vec<ParameterValue> parameters;
|
||||
Result res;
|
||||
ASSERT_OK(stream->getParameters(keys, returnIn(res, parameters)));
|
||||
ASSERT_OK(Parameters::get(stream, keys, returnIn(res, parameters)));
|
||||
ASSERT_RESULT(expectedResults, res);
|
||||
if (res == Result::OK) {
|
||||
for (auto& parameter : parameters) {
|
||||
@@ -831,22 +940,22 @@ TEST_IO_STREAM(getNonExistingParameter, "Retrieve the values of an non existing
|
||||
{Result::NOT_SUPPORTED}))
|
||||
|
||||
TEST_IO_STREAM(setEmptySetParameter, "Set the values of an empty set of parameters",
|
||||
ASSERT_RESULT(Result::OK, stream->setParameters({})))
|
||||
ASSERT_RESULT(Result::OK, Parameters::set(stream, {})))
|
||||
|
||||
TEST_IO_STREAM(setNonExistingParameter, "Set the values of an non existing parameter",
|
||||
// Unfortunately, the set_parameter legacy interface did not return any
|
||||
// error code when a key is not supported.
|
||||
// To allow implementation to just wrapped the legacy one, consider OK as a
|
||||
// valid result for setting a non existing parameter.
|
||||
ASSERT_RESULT(invalidArgsOrNotSupportedOrOK,
|
||||
stream->setParameters({{"non existing key", "0"}})))
|
||||
ASSERT_RESULT(okOrNotSupportedOrInvalidArgs,
|
||||
Parameters::set(stream, {{"non existing key", "0"}})))
|
||||
|
||||
TEST_IO_STREAM(DebugDump, "Check that a stream can dump its state without error",
|
||||
testDebugDump([this](const auto& handle) { return stream->debugDump(handle); }))
|
||||
testDebugDump([this](const auto& handle) { return dump(stream, handle); }))
|
||||
|
||||
TEST_IO_STREAM(DebugDumpInvalidArguments,
|
||||
"Check that the stream dump doesn't crash on invalid arguments",
|
||||
ASSERT_OK(stream->debugDump(hidl_handle())))
|
||||
ASSERT_OK(dump(stream, hidl_handle())))
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////// addRemoveEffect ///////////////////////////////
|
||||
@@ -866,8 +975,6 @@ TEST_IO_STREAM(RemoveNonExistingEffect, "Removing a non existing effect should f
|
||||
TEST_IO_STREAM(standby, "Make sure the stream can be put in stanby",
|
||||
ASSERT_OK(stream->standby())) // can not fail
|
||||
|
||||
static constexpr auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED};
|
||||
|
||||
TEST_IO_STREAM(startNoMmap, "Starting a mmaped stream before mapping it should fail",
|
||||
ASSERT_RESULT(invalidStateOrNotSupported, stream->start()))
|
||||
|
||||
@@ -881,7 +988,6 @@ TEST_IO_STREAM(close, "Make sure a stream can be closed", ASSERT_OK(closeStream(
|
||||
TEST_IO_STREAM(closeTwice, "Make sure a stream can not be closed twice", ASSERT_OK(closeStream());
|
||||
ASSERT_RESULT(Result::INVALID_STATE, closeStream()))
|
||||
|
||||
static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED};
|
||||
static void testCreateTooBigMmapBuffer(IStream* stream) {
|
||||
MmapBufferInfo info;
|
||||
Result res;
|
||||
@@ -988,15 +1094,19 @@ TEST_P(InputStreamTest, GetInputFramesLost) {
|
||||
TEST_P(InputStreamTest, getCapturePosition) {
|
||||
doc::test(
|
||||
"The capture position of a non prepared stream should not be "
|
||||
"retrievable");
|
||||
"retrievable or 0");
|
||||
uint64_t frames;
|
||||
uint64_t time;
|
||||
ASSERT_OK(stream->getCapturePosition(returnIn(res, frames, time)));
|
||||
ASSERT_RESULT(invalidStateOrNotSupported, res);
|
||||
ASSERT_RESULT(okOrInvalidStateOrNotSupported, res);
|
||||
if (res == Result::OK) {
|
||||
ASSERT_EQ(0U, frames);
|
||||
ASSERT_LE(0U, time);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////// StreamIn ///////////////////////////////////
|
||||
///////////////////////////////// StreamOut //////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TEST_P(OutputStreamTest, getLatency) {
|
||||
@@ -1103,7 +1213,6 @@ static bool isAsyncModeSupported(IStreamOut* stream) {
|
||||
auto res = stream->setCallback(new MockOutCallbacks);
|
||||
stream->clearCallback(); // try to restore the no callback state, ignore
|
||||
// any error
|
||||
auto okOrNotSupported = {Result::OK, Result::NOT_SUPPORTED};
|
||||
EXPECT_RESULT(okOrNotSupported, res);
|
||||
return res.isOk() ? res == Result::OK : false;
|
||||
}
|
||||
@@ -1152,7 +1261,7 @@ TEST_P(OutputStreamTest, Pause) {
|
||||
doc::partialTest("The output stream does not support pause");
|
||||
return;
|
||||
}
|
||||
ASSERT_RESULT(Result::INVALID_STATE, stream->resume());
|
||||
ASSERT_RESULT(Result::INVALID_STATE, stream->pause());
|
||||
}
|
||||
|
||||
static void testDrain(IStreamOut* stream, AudioDrain type) {
|
||||
@@ -1222,48 +1331,33 @@ TEST_F(AudioPrimaryHidlTest, setVoiceVolume) {
|
||||
testUnitaryGain([](float volume) { return device->setVoiceVolume(volume); });
|
||||
}
|
||||
|
||||
TEST_F(AudioPrimaryHidlTest, setMode) {
|
||||
doc::test(
|
||||
"Make sure setMode always succeeds if mode is valid "
|
||||
"and fails otherwise");
|
||||
// Test Invalid values
|
||||
for (AudioMode mode : {AudioMode::INVALID, AudioMode::CURRENT, AudioMode::CNT}) {
|
||||
SCOPED_TRACE("mode=" + toString(mode));
|
||||
ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(mode));
|
||||
}
|
||||
// Test valid values
|
||||
for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
|
||||
AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
|
||||
SCOPED_TRACE("mode=" + toString(mode));
|
||||
ASSERT_OK(device->setMode(mode));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(BoolAccessorPrimaryHidlTest, BtScoNrecEnabled) {
|
||||
doc::test("Query and set the BT SCO NR&EC state");
|
||||
testOptionalAccessors("BtScoNrecEnabled", {true, false, true},
|
||||
&IPrimaryDevice::setBtScoNrecEnabled,
|
||||
&IPrimaryDevice::getBtScoNrecEnabled);
|
||||
testAccessors<OPTIONAL>("BtScoNrecEnabled", Initial{false, OPTIONAL}, {true},
|
||||
&IPrimaryDevice::setBtScoNrecEnabled,
|
||||
&IPrimaryDevice::getBtScoNrecEnabled);
|
||||
}
|
||||
|
||||
TEST_F(BoolAccessorPrimaryHidlTest, setGetBtScoWidebandEnabled) {
|
||||
doc::test("Query and set the SCO whideband state");
|
||||
testOptionalAccessors("BtScoWideband", {true, false, true},
|
||||
&IPrimaryDevice::setBtScoWidebandEnabled,
|
||||
&IPrimaryDevice::getBtScoWidebandEnabled);
|
||||
testAccessors<OPTIONAL>("BtScoWideband", Initial{false, OPTIONAL}, {true},
|
||||
&IPrimaryDevice::setBtScoWidebandEnabled,
|
||||
&IPrimaryDevice::getBtScoWidebandEnabled);
|
||||
}
|
||||
|
||||
using TtyModeAccessorPrimaryHidlTest = AccessorPrimaryHidlTest<TtyMode>;
|
||||
using TtyModeAccessorPrimaryHidlTest = AccessorPrimaryHidlTest<IPrimaryDevice::TtyMode>;
|
||||
TEST_F(TtyModeAccessorPrimaryHidlTest, setGetTtyMode) {
|
||||
doc::test("Query and set the TTY mode state");
|
||||
testOptionalAccessors("TTY mode", {TtyMode::OFF, TtyMode::HCO, TtyMode::VCO, TtyMode::FULL},
|
||||
&IPrimaryDevice::setTtyMode, &IPrimaryDevice::getTtyMode);
|
||||
testAccessors<OPTIONAL>(
|
||||
"TTY mode", Initial{IPrimaryDevice::TtyMode::OFF},
|
||||
{IPrimaryDevice::TtyMode::HCO, IPrimaryDevice::TtyMode::VCO, IPrimaryDevice::TtyMode::FULL},
|
||||
&IPrimaryDevice::setTtyMode, &IPrimaryDevice::getTtyMode);
|
||||
}
|
||||
|
||||
TEST_F(BoolAccessorPrimaryHidlTest, setGetHac) {
|
||||
doc::test("Query and set the HAC state");
|
||||
testOptionalAccessors("HAC", {true, false, true}, &IPrimaryDevice::setHacEnabled,
|
||||
&IPrimaryDevice::getHacEnabled);
|
||||
testAccessors<OPTIONAL>("HAC", Initial{false}, {true}, &IPrimaryDevice::setHacEnabled,
|
||||
&IPrimaryDevice::getHacEnabled);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "AEC_Effect_HAL"
|
||||
|
||||
#include "AcousticEchoCancelerEffect.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/AcousticEchoCancelerEffect.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H
|
||||
#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H
|
||||
|
||||
#include <android/hardware/audio/effect/2.0/IAcousticEchoCancelerEffect.h>
|
||||
|
||||
#include "Effect.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/AcousticEchoCancelerEffect.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H
|
||||
@@ -1,50 +0,0 @@
|
||||
cc_library_shared {
|
||||
name: "android.hardware.audio.effect@2.0-impl",
|
||||
defaults: ["hidl_defaults"],
|
||||
vendor: true,
|
||||
relative_install_path: "hw",
|
||||
srcs: [
|
||||
"AcousticEchoCancelerEffect.cpp",
|
||||
"AudioBufferManager.cpp",
|
||||
"AutomaticGainControlEffect.cpp",
|
||||
"BassBoostEffect.cpp",
|
||||
"Conversions.cpp",
|
||||
"DownmixEffect.cpp",
|
||||
"Effect.cpp",
|
||||
"EffectsFactory.cpp",
|
||||
"EnvironmentalReverbEffect.cpp",
|
||||
"EqualizerEffect.cpp",
|
||||
"LoudnessEnhancerEffect.cpp",
|
||||
"NoiseSuppressionEffect.cpp",
|
||||
"PresetReverbEffect.cpp",
|
||||
"VirtualizerEffect.cpp",
|
||||
"VisualizerEffect.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libeffects",
|
||||
"libfmq",
|
||||
"libhidlbase",
|
||||
"libhidlmemory",
|
||||
"libhidltransport",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"android.hardware.audio.common-util",
|
||||
"android.hardware.audio.common@2.0",
|
||||
"android.hardware.audio.common@2.0-util",
|
||||
"android.hardware.audio.effect@2.0",
|
||||
"android.hidl.memory@1.0",
|
||||
],
|
||||
|
||||
header_libs: [
|
||||
"android.hardware.audio.common.util@all-versions",
|
||||
"android.hardware.audio.effect@all-versions-impl",
|
||||
"libaudio_system_headers",
|
||||
"libaudioclient_headers",
|
||||
"libeffects_headers",
|
||||
"libhardware_headers",
|
||||
"libmedia_headers",
|
||||
],
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "AudioBufferManager.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/AudioBufferManager.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUDIO_BUFFER_MANAGER_H_
|
||||
#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUDIO_BUFFER_MANAGER_H_
|
||||
|
||||
#include <android/hardware/audio/effect/2.0/types.h>
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/AudioBufferManager.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUDIO_BUFFER_MANAGER_H_
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "AGC_Effect_HAL"
|
||||
|
||||
#include "AutomaticGainControlEffect.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/AutomaticGainControlEffect.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUTOMATICGAINCONTROLEFFECT_H
|
||||
#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUTOMATICGAINCONTROLEFFECT_H
|
||||
|
||||
#include <android/hardware/audio/effect/2.0/IAutomaticGainControlEffect.h>
|
||||
|
||||
#include "Effect.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/AutomaticGainControlEffect.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_AUTOMATICGAINCONTROLEFFECT_H
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "BassBoost_HAL"
|
||||
|
||||
#include "BassBoostEffect.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/BassBoostEffect.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H
|
||||
#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H
|
||||
|
||||
#include <android/hardware/audio/effect/2.0/IBassBoostEffect.h>
|
||||
|
||||
#include <hidl/MQDescriptor.h>
|
||||
|
||||
#include "Effect.h"
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/BassBoostEffect.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
|
||||
#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "Conversions.h"
|
||||
#include "HidlUtils.h"
|
||||
|
||||
using ::android::hardware::audio::common::V2_0::HidlUtils;
|
||||
|
||||
#define AUDIO_HAL_VERSION V2_0
|
||||
#include <effect/all-versions/default/Conversions.impl.h>
|
||||
#undef AUDIO_HAL_VERSION
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user