Audio HAL: Factorize V2 and V4 like libaudiohal

Use the same technique developed for the simpler libaudiohal to
factorize the audio HAL impl.

Generated with script:

set -euo pipefail

cd hardware/interfaces/audio

# Make 2.0 and 4.0 files mostly identical by removing all 2.0, V4.0...
# and replacing it by CPP_VERSION and FILE_VERSION
# This allow both implementation to be mostly identical, except for code difference
# Also remove IncludeGuard.h as it will be included from compiler flag
# Also update license to 2018
find -name *.cpp -o -name *h |
    grep -v -e service.cpp |
    xargs sed -Ei \
        -e 's/(#.*)V[42]_0_(.*_H_?)$/\1\2/' \
        -e 's/(LOG_TAG.*)[24]_0/\1/' \
        -e '/#ifndef AUDIO_HAL_VERSION/,/#endif/d' \
        -e '/^#.*def.*AUDIO_HAL_VERSION\b/d' \
        -e's/V[42]_0/CPP_VERSION/' \
        -e 's/(#include ).(android.*)[24].0(.*).$/\1PATH(\2FILE_VERSION\3)/' \
        -e 's|(#include) .(.*)[24].0/(default/.*).$|\1 "\2\3"|' \
        -e 's/\bAUDIO_HAL_VERSION\b/CPP_VERSION/' \
        -e '/IncludeGuard.h/d' \
        -e 's/(Copyright .C. 201)./\18/'

# set MAJOR_VERSION instead of having a different macro for each version
# this allow to do preprocessor arithmetic (eg: MAJOR_VERSION >= 4)
for v in 2 4; do
    find -ipath '*/'$v'.0/*/Android.bp' |
        xargs sed -i -e '/cflags:/,/^$/d' -e '/vndk/{:a;/}/!{N;ba};d}' -e '$i\
    cflags: [\
        "-DMAJOR_VERSION='$v'",\
        "-DMINOR_VERSION=0",\
        "-include common/all-versions/VersionMacro.h",\
    ]'; done

# replace# ifdef VERSION_X by #if MAJOR_VERSION == X
find -path *all-versions/*.h |
    xargs sed -Ei -e 's/def.*AUDIO_HAL_VERSION_([24])_0.*/ MAJOR_VERSION == \1/' \
                  -e 'T;s/ +/ /'

# copy all-versions impl in each version impl
find -path '*/[24].0/*.[hc]*' |
    grep -ve all-versions -e test |
    xargs -P99 -n4 sed -i -Ee '/include <.*all-versions.default/!b' \
        -e 's#.*<#find -path */#' -e 's/>$/|xargs tail -n +16/' -e e

# remove all-versions impl
rm -r {core,effect}/all-versions/

# merge version impl into a single all-version
for dir in core/*.0/vts/functional/*.0/ ;do
    dest=$(echo $dir | sed 's#/..0/#/all-versions/#')
    mkdir -p $dest
    mv -T $dir $dest
done

find -mindepth 3 -path '*/2.0/*' -a \( -name '*cpp' -o -name '*h' \) |
    grep -v 'all-versions' |
    sed -E 'h;s/2/4/g;H;s/4.0/all-versions/;s/4.0//;H;g;s/\n/ /g;'|
    xargs -P99 -L1 sh -c '
        set -euo pipefail
        mkdir -p $(dirname $2);
        diff --old-group-format="#if MAJOR_VERSION == 2
%<#endif
" \
             --new-group-format="#if MAJOR_VERSION == 4
%>#endif
"       $0 $1 > $2 || true;
        rm $0 $1'

# merge the X.0 Android.bp & OWNERS in the all-versions
for dir in common effect core; do
    for sub in default vts/functional; do
        test -f $dir/2.0/$sub/Android.bp || continue
        awk 1 $dir/*.0/$sub/Android.bp >> $dir/all-versions/$sub/Android.bp
        # delete licenses except for the first one and add whitelines
        sed -i -e '/^}$/{N;/^}\n$/!s/\n/&\n/}' $dir/all-versions/$sub/Android.bp
        sed -i -e '1,17b;/^\/\//,/^$/{d}' $dir/all-versions/$sub/Android.bp
    done
    for sub in default vts; do
        test -d $dir/2.0/$sub || continue
        test -f $dir/2.0/$sub/OWNERS &&
            awk 1 $dir/*.0/$sub/OWNERS | sort -u > $dir/all-versions/$sub/OWNERS ||
            true
        rm -r $dir/*.0/$sub
    done
done

# delete all-versions-impl dependencies
find -name 'Android.bp' | xargs sed -i -e '/all-versions-impl/d'

# cleanup unused files
rm common/all-versions/default/include/common/all-versions/default/HidlUtils*
rm common/all-versions/util/include/common/all-versions/IncludeGuard.h
find -depth -type d -empty -delete

# Clamp consecutive number of empty lines to 2
find -name *.cpp -o -name *h | xargs sed -Ei ':a;/^\n*$/{N;ba};s/\n\n+/\n\n/'

# transform #endif\n#if to #elif
find -name *.cpp -o -name *h | xargs sed -i '/^#endif/{N;s/.*\n#if/#elif/}'

# remove leftover include guard in cpp
find -name *.cpp |xargs sed -Ei '/^#.*_H_?$/d'

# apply clang-format
find -name *cpp -o -name *h |
    xargs ../../../prebuilts/clang/host/linux-x86/clang-stable/bin/clang-format --style file -i
# clang format breaks PATH(a/b) to PATH(a / b), remove the space surrounding /
find -name *cpp -o -name *h | xargs sed -i "/#include PATH/s# / #/#g"

Test: compile
Bug: 118203066
Change-Id: I3692a444307afc5f71064fe0b9e6b8af3c9ff1dd
Signed-off-by: Kevin Rocard <krocard@google.com>
This commit is contained in:
Kevin Rocard
2018-11-14 16:22:07 -08:00
parent 6166ef40f9
commit 96d2cd9d5c
196 changed files with 1245 additions and 5843 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -38,3 +38,73 @@ cc_library_shared {
"android.hardware.audio.common.util@all-versions",
]
}
cc_library_shared {
name: "android.hardware.audio.common@2.0-util",
defaults: ["hidl_defaults"],
vendor_available: true,
srcs: [
"HidlUtils.cpp",
],
export_include_dirs: ["."],
static_libs: [
],
shared_libs: [
"liblog",
"libutils",
"libhidlbase",
"android.hardware.audio.common-util",
"android.hardware.audio.common@2.0",
],
export_shared_lib_headers: [
"android.hardware.audio.common-util"
],
header_libs: [
"libaudio_system_headers",
"libhardware_headers",
],
cflags: [
"-DMAJOR_VERSION=2",
"-DMINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
]
}
cc_library_shared {
name: "android.hardware.audio.common@4.0-util",
defaults: ["hidl_defaults"],
vendor_available: true,
srcs: [
"HidlUtils.cpp",
],
export_include_dirs: ["."],
static_libs: [
],
shared_libs: [
"liblog",
"libutils",
"libhidlbase",
"android.hardware.audio.common-util",
"android.hardware.audio.common@4.0",
],
export_shared_lib_headers: [
"android.hardware.audio.common-util"
],
header_libs: [
"libaudio_system_headers",
"libhardware_headers",
],
cflags: [
"-DMAJOR_VERSION=4",
"-DMINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
]
}

View File

@@ -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.

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 The Android Open Source Project
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,24 +14,22 @@
* limitations under the License.
*/
#ifndef AUDIO_HAL_VERSION
#error "AUDIO_HAL_VERSION must be set before including this file."
#endif
#include "HidlUtils.h"
#include <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::CPP_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
using ::android::hardware::audio::common::CPP_VERSION::AudioGainMode;
using ::android::hardware::audio::common::CPP_VERSION::AudioMixLatencyClass;
using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfigMask;
using ::android::hardware::audio::common::CPP_VERSION::AudioPortRole;
using ::android::hardware::audio::common::CPP_VERSION::AudioPortType;
using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
using ::android::hardware::audio::common::CPP_VERSION::AudioStreamType;
using ::android::hardware::audio::common::CPP_VERSION::AudioUsage;
using ::android::hardware::audio::common::utils::EnumBitfield;
@@ -39,7 +37,7 @@ namespace android {
namespace hardware {
namespace audio {
namespace common {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
void HidlUtils::audioConfigFromHal(const audio_config_t& halConfig, AudioConfig* config) {
config->sampleRateHz = halConfig.sample_rate;
@@ -358,7 +356,7 @@ void HidlUtils::uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid) {
memcpy(halUuid->node, uuid.node.data(), uuid.node.size());
}
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace common
} // namespace audio
} // namespace hardware

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 The Android Open Source Project
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,28 +14,29 @@
* limitations under the License.
*/
#ifndef AUDIO_HAL_VERSION
#error "AUDIO_HAL_VERSION must be set before including this file."
#endif
#ifndef android_hardware_audio_Hidl_Utils_H_
#define android_hardware_audio_Hidl_Utils_H_
#include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
#include <memory>
#include <system/audio.h>
using ::android::hardware::hidl_vec;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGain;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGainConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOffloadInfo;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid;
using ::android::hardware::audio::common::CPP_VERSION::AudioConfig;
using ::android::hardware::audio::common::CPP_VERSION::AudioGain;
using ::android::hardware::audio::common::CPP_VERSION::AudioGainConfig;
using ::android::hardware::audio::common::CPP_VERSION::AudioOffloadInfo;
using ::android::hardware::audio::common::CPP_VERSION::AudioPort;
using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfig;
using ::android::hardware::audio::common::CPP_VERSION::Uuid;
namespace android {
namespace hardware {
namespace audio {
namespace common {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
class HidlUtils {
public:
@@ -68,8 +69,10 @@ class HidlUtils {
static void uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid);
};
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace common
} // namespace audio
} // namespace hardware
} // namespace android
#endif // android_hardware_audio_Hidl_Utils_H_

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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",
],
}

View File

@@ -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

View File

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

View File

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

View File

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

View File

@@ -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

View File

@@ -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

View File

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

View File

@@ -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

View File

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

View File

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

View File

@@ -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

View File

@@ -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_

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

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

View File

@@ -1,39 +0,0 @@
//
// Copyright (C) 2017 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
cc_test {
name: "VtsHalAudioV2_0TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
srcs: [
"2.0/AudioPrimaryHidlHalTest.cpp",
"ValidateAudioConfiguration.cpp"
],
static_libs: [
"android.hardware.audio.common.test.utility",
"android.hardware.audio@2.0",
"android.hardware.audio.common@2.0",
"libicuuc",
"libicuuc_stubdata",
"libxml2",
],
shared_libs: [
"libfmq",
],
header_libs: [
"android.hardware.audio.common.util@all-versions",
],
test_suites: ["general-tests"],
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <unistd.h>
#include <string>
#include "utility/ValidateXml.h"
// Stringify the argument.
#define QUOTE(x) #x
#define STRINGIFY(x) QUOTE(x)
#define AUDIO_HAL_VERSION V2_0
TEST(CheckConfig, audioPolicyConfigurationValidation) {
RecordProperty("description",
"Verify that the audio policy configuration file "
"is valid according to the schema");
std::vector<const char*> locations = {"/odm/etc", "/vendor/etc", "/system/etc"};
const char* xsd =
"/data/local/tmp/audio_policy_configuration_" STRINGIFY(AUDIO_HAL_VERSION) ".xsd";
EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("audio_policy_configuration.xml", locations, xsd);
}

View File

@@ -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",
],
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -1,3 +0,0 @@
elaurent@google.com
krocard@google.com
mnaganov@google.com

View File

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

View File

@@ -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

View File

@@ -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

View File

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

View File

@@ -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

View File

@@ -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_

View File

@@ -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

View File

@@ -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

View File

@@ -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_

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

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

View File

@@ -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

View File

@@ -1,3 +0,0 @@
elaurent@google.com
krocard@google.com
mnaganov@google.com

View File

@@ -1,7 +1,18 @@
cc_library_headers {
name: "android.hardware.audio.core@all-versions-impl",
cc_library_shared {
name: "android.hardware.audio@2.0-impl",
relative_install_path: "hw",
proprietary: true,
vendor: true,
srcs: [
"Conversions.cpp",
"Device.cpp",
"DevicesFactory.cpp",
"ParametersUtil.cpp",
"PrimaryDevice.cpp",
"Stream.cpp",
"StreamIn.cpp",
"StreamOut.cpp",
],
defaults: ["hidl_defaults"],
@@ -16,14 +27,81 @@ cc_library_headers {
"libhidltransport",
"liblog",
"libutils",
"android.hardware.audio@2.0",
"android.hardware.audio.common@2.0",
"android.hardware.audio.common@2.0-util",
"android.hardware.audio.common-util",
],
header_libs: [
"android.hardware.audio.common.util@all-versions",
"libaudioclient_headers",
"libaudio_system_headers",
"libhardware_headers",
"libmedia_headers",
"android.hardware.audio.common.util@all-versions",
],
whole_static_libs: [
"libmedia_helper",
],
cflags: [
"-DMAJOR_VERSION=2",
"-DMINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
]
}
cc_library_shared {
name: "android.hardware.audio@4.0-impl",
relative_install_path: "hw",
proprietary: true,
vendor: true,
srcs: [
"Conversions.cpp",
"Device.cpp",
"DevicesFactory.cpp",
"ParametersUtil.cpp",
"PrimaryDevice.cpp",
"Stream.cpp",
"StreamIn.cpp",
"StreamOut.cpp",
],
defaults: ["hidl_defaults"],
export_include_dirs: ["include"],
shared_libs: [
"libbase",
"libcutils",
"libfmq",
"libhardware",
"libhidlbase",
"libhidltransport",
"liblog",
"libutils",
"android.hardware.audio@4.0",
"android.hardware.audio.common@4.0",
"android.hardware.audio.common@4.0-util",
"android.hardware.audio.common-util",
],
header_libs: [
"android.hardware.audio.common.util@all-versions",
"libaudioclient_headers",
"libaudio_system_headers",
"libhardware_headers",
"libmedia_headers",
],
whole_static_libs: [
"libmedia_helper",
],
cflags: [
"-DMAJOR_VERSION=4",
"-DMINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
]
}

View File

@@ -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,10 +23,10 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
std::string deviceAddressToHal(const DeviceAddress& address) {
// HAL assumes that the address is NUL-terminated.
@@ -58,7 +58,7 @@ std::string deviceAddressToHal(const DeviceAddress& address) {
return halAddress;
}
#ifdef AUDIO_HAL_VERSION_4_0
#if MAJOR_VERSION == 4
status_t deviceAddressFromHal(audio_devices_t device, const char* halAddress,
DeviceAddress* address) {
if (address == nullptr) {
@@ -188,7 +188,7 @@ bool halToMicrophoneCharacteristics(MicrophoneInfo* pDst,
#endif
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -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,12 +31,12 @@
#include <android/log.h>
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils;
using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
Device::Device(audio_hw_device_t* device) : mDevice(device) {}
@@ -61,7 +68,7 @@ int Device::halSetParameters(const char* keysAndValues) {
return mDevice->set_parameters(mDevice, keysAndValues);
}
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
// Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow.
Return<Result> Device::initCheck() {
return analyzeStatus("init_check", mDevice->init_check(mDevice));
}
@@ -132,7 +139,7 @@ Return<void> Device::getInputBufferSize(const AudioConfig& config, getInputBuffe
Return<void> Device::openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioOutputFlagBitfield flags,
#ifdef AUDIO_HAL_VERSION_4_0
#if MAJOR_VERSION == 4
const SourceMetadata& /* sourceMetadata */,
#endif
openOutputStream_cb _hidl_cb) {
@@ -190,7 +197,7 @@ Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& devi
return Void();
}
#ifdef AUDIO_HAL_VERSION_4_0
#if MAJOR_VERSION == 4
Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioInputFlagBitfield flags,
const SinkMetadata& sinkMetadata,
@@ -263,13 +270,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);
@@ -282,7 +289,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();
@@ -291,7 +298,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);
@@ -303,7 +310,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, {});
}
@@ -316,7 +323,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;
@@ -342,7 +349,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

View File

@@ -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);
@@ -111,7 +114,7 @@ IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name) {
}
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 The Android Open Source Project
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,13 +14,16 @@
* limitations under the License.
*/
#include <common/all-versions/IncludeGuard.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*
@@ -158,7 +161,7 @@ Result ParametersUtil::setParams(const AudioParameter& param) {
}
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -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

View File

@@ -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) {}
@@ -56,7 +61,7 @@ int Stream::halSetParameters(const char* keysAndValues) {
return mStream->set_parameters(mStream, keysAndValues);
}
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
Return<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.
@@ -78,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);
}
@@ -106,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 defined(AUDIO_HAL_VERSION_4_0)
#elif MAJOR_VERSION == 4
_hidl_cb(result, sampleRates);
#endif
return Void();
@@ -135,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();
@@ -216,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);
@@ -241,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);
@@ -313,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

View File

@@ -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 "StreamInHAL"
#include "core/default/StreamIn.h"
#include "core/default/Conversions.h"
#include "core/default/Util.h"
//#define LOG_NDEBUG 0
#define ATRACE_TAG ATRACE_TAG_AUDIO
@@ -24,13 +28,13 @@
#include <utils/Trace.h>
#include <memory>
using ::android::hardware::audio::AUDIO_HAL_VERSION::MessageQueueFlagBits;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
using ::android::hardware::audio::common::CPP_VERSION::ThreadInfo;
using ::android::hardware::audio::CPP_VERSION::MessageQueueFlagBits;
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
namespace {
@@ -160,7 +164,7 @@ StreamIn::~StreamIn() {
mStream = nullptr;
}
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
Return<uint64_t> StreamIn::getFrameSize() {
return audio_stream_in_frame_size(mStream);
}
@@ -177,7 +181,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);
}
@@ -239,7 +243,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);
}
@@ -263,7 +267,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);
}
@@ -311,7 +315,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);
@@ -445,7 +449,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
@@ -485,7 +489,7 @@ Return<void> StreamIn::getActiveMicrophones(getActiveMicrophones_cb _hidl_cb) {
#endif
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android

View File

@@ -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,10 +31,10 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
using ::android::hardware::audio::common::CPP_VERSION::ThreadInfo;
namespace {
@@ -165,7 +168,7 @@ StreamOut::~StreamOut() {
mStream = nullptr;
}
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
Return<uint64_t> StreamOut::getFrameSize() {
return audio_stream_out_frame_size(mStream);
}
@@ -182,7 +185,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 +247,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 +272,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 +304,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);
}
@@ -544,7 +547,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
@@ -571,7 +574,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

View File

@@ -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,22 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
std::string deviceAddressToHal(const DeviceAddress& address);
#ifdef AUDIO_HAL_VERSION_4_0
#if MAJOR_VERSION == 4
bool halToMicrophoneCharacteristics(MicrophoneInfo* pDst,
const struct audio_microphone_characteristic_t& src);
#endif
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_CONVERSIONS_H_

View File

@@ -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,7 +35,7 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::sp;
@@ -38,33 +43,32 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioHwSync;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPatchHandle;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioInputFlagBitfield;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::
AudioOutputFlagBitfield;
using ::android::hardware::audio::common::CPP_VERSION::AudioConfig;
using ::android::hardware::audio::common::CPP_VERSION::AudioHwSync;
using ::android::hardware::audio::common::CPP_VERSION::AudioInputFlag;
using ::android::hardware::audio::common::CPP_VERSION::AudioOutputFlag;
using ::android::hardware::audio::common::CPP_VERSION::AudioPatchHandle;
using ::android::hardware::audio::common::CPP_VERSION::AudioPort;
using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfig;
using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioInputFlagBitfield;
using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioOutputFlagBitfield;
using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
using ::android::hardware::audio::CPP_VERSION::IDevice;
using ::android::hardware::audio::CPP_VERSION::IStreamIn;
using ::android::hardware::audio::CPP_VERSION::IStreamOut;
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using ::android::hardware::audio::CPP_VERSION::Result;
#ifdef AUDIO_HAL_VERSION_4_0
using ::android::hardware::audio::AUDIO_HAL_VERSION::SinkMetadata;
using ::android::hardware::audio::AUDIO_HAL_VERSION::SourceMetadata;
#if MAJOR_VERSION == 4
using ::android::hardware::audio::CPP_VERSION::SinkMetadata;
using ::android::hardware::audio::CPP_VERSION::SourceMetadata;
#endif
struct Device : public IDevice, public ParametersUtil {
explicit Device(audio_hw_device_t* device);
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
// Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow.
Return<Result> initCheck() override;
Return<Result> setMasterVolume(float volume) override;
Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
@@ -79,11 +83,11 @@ struct Device : public IDevice, public ParametersUtil {
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
#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)
#elif MAJOR_VERSION == 4
Return<void> openOutputStream(int32_t ioHandle, const DeviceAddress& device,
const AudioConfig& config, AudioOutputFlagBitfield flags,
const SourceMetadata& sourceMetadata,
@@ -104,13 +108,13 @@ struct Device : public IDevice, public ParametersUtil {
Return<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,
@@ -143,7 +147,9 @@ struct Device : public IDevice, public ParametersUtil {
};
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_DEVICE_H

View File

@@ -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,7 +27,7 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::sp;
@@ -32,15 +35,14 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::audio::CPP_VERSION::IDevice;
using ::android::hardware::audio::CPP_VERSION::IDevicesFactory;
using ::android::hardware::audio::CPP_VERSION::Result;
struct DevicesFactory : public IDevicesFactory {
#ifdef AUDIO_HAL_VERSION_2_0
#if MAJOR_VERSION == 2
Return<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 +58,9 @@ struct DevicesFactory : public IDevicesFactory {
extern "C" IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name);
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_DEVICESFACTORY_H

View File

@@ -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,14 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using ::android::hardware::audio::CPP_VERSION::Result;
class ParametersUtil {
public:
@@ -60,7 +63,9 @@ class ParametersUtil {
};
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_

View File

@@ -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,7 +28,7 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::sp;
@@ -31,25 +36,25 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
using ::android::hardware::audio::common::CPP_VERSION::AudioConfig;
using ::android::hardware::audio::common::CPP_VERSION::AudioInputFlag;
using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
using ::android::hardware::audio::common::CPP_VERSION::AudioOutputFlag;
using ::android::hardware::audio::common::CPP_VERSION::AudioPort;
using ::android::hardware::audio::common::CPP_VERSION::AudioPortConfig;
using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
using ::android::hardware::audio::CPP_VERSION::IDevice;
using ::android::hardware::audio::CPP_VERSION::IPrimaryDevice;
using ::android::hardware::audio::CPP_VERSION::IStreamIn;
using ::android::hardware::audio::CPP_VERSION::IStreamOut;
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using ::android::hardware::audio::CPP_VERSION::Result;
struct PrimaryDevice : public IPrimaryDevice {
explicit PrimaryDevice(audio_hw_device_t* device);
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow.
// Methods from ::android::hardware::audio::CPP_VERSION::IDevice follow.
Return<Result> initCheck() override;
Return<Result> setMasterVolume(float volume) override;
Return<void> getMasterVolume(getMasterVolume_cb _hidl_cb) override;
@@ -62,7 +67,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 +75,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 +92,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 +111,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 +123,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 +139,9 @@ struct PrimaryDevice : public IPrimaryDevice {
};
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H

View File

@@ -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,7 +33,7 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::sp;
@@ -36,14 +41,14 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield;
using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield;
using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
using ::android::hardware::audio::CPP_VERSION::IStream;
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using ::android::hardware::audio::CPP_VERSION::Result;
struct Stream : public IStream, public ParametersUtil {
explicit Stream(audio_stream_t* stream);
@@ -55,12 +60,12 @@ struct Stream : public IStream, public ParametersUtil {
*/
static constexpr uint32_t MAX_BUFFER_SIZE = 2 << 30 /* == 1GiB */;
// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
Return<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 +81,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 +105,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 +176,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 +215,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

View File

@@ -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,7 +34,7 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::sp;
@@ -36,15 +42,15 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
using ::android::hardware::audio::CPP_VERSION::IStream;
using ::android::hardware::audio::CPP_VERSION::IStreamIn;
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using ::android::hardware::audio::CPP_VERSION::Result;
struct StreamIn : public IStreamIn {
typedef MessageQueue<ReadParameters, kSynchronizedReadWrite> CommandMQ;
@@ -53,12 +59,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 +80,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 +100,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,7 +115,7 @@ 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
@@ -134,7 +140,9 @@ struct StreamIn : public IStreamIn {
};
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_STREAMIN_H

View File

@@ -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,7 +34,7 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::sp;
@@ -36,17 +42,17 @@ using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::audio::AUDIO_HAL_VERSION::AudioDrain;
using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOutCallback;
using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::audio::AUDIO_HAL_VERSION::TimeSpec;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
using ::android::hardware::audio::CPP_VERSION::AudioDrain;
using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
using ::android::hardware::audio::CPP_VERSION::IStream;
using ::android::hardware::audio::CPP_VERSION::IStreamOut;
using ::android::hardware::audio::CPP_VERSION::IStreamOutCallback;
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using ::android::hardware::audio::CPP_VERSION::Result;
using ::android::hardware::audio::CPP_VERSION::TimeSpec;
struct StreamOut : public IStreamOut {
typedef MessageQueue<WriteCommand, kSynchronizedReadWrite> CommandMQ;
@@ -55,12 +61,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 +82,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 +102,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 +126,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 +154,9 @@ struct StreamOut : public IStreamOut {
};
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_STREAMOUT_H

View File

@@ -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,10 @@
namespace android {
namespace hardware {
namespace audio {
namespace AUDIO_HAL_VERSION {
namespace CPP_VERSION {
namespace implementation {
using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::audio::CPP_VERSION::Result;
/** @return true if gain is between 0 and 1 included. */
constexpr bool isGainNormalized(float gain) {
@@ -68,7 +71,9 @@ static inline Result analyzeStatus(const char* className, const char* funcName,
} // namespace util
} // namespace implementation
} // namespace AUDIO_HAL_VERSION
} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_AUDIO_UTIL_H

View File

@@ -2,4 +2,4 @@ elaurent@google.com
krocard@google.com
mnaganov@google.com
yim@google.com
zhuoyao@google.com
zhuoyao@google.com

View File

@@ -14,19 +14,19 @@
* limitations under the License.
*/
#include <android/hardware/audio/2.0/IStream.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/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::V2_0::AudioChannelMask;
using ::android::hardware::audio::common::V2_0::AudioFormat;
using ::android::hardware::audio::V2_0::IStream;
using ::android::hardware::audio::V2_0::ParameterValue;
using ::android::hardware::audio::V2_0::Result;
using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
using ::android::hardware::audio::CPP_VERSION::IStream;
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using ::android::hardware::audio::CPP_VERSION::Result;
using namespace ::android::hardware::audio::common::test::utility;

View File

@@ -14,29 +14,29 @@
* limitations under the License.
*/
#include <android/hardware/audio/4.0/IStream.h>
#include <android/hardware/audio/4.0/types.h>
#include <android/hardware/audio/common/4.0/types.h>
#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::V4_0::AudioChannelMask;
using ::android::hardware::audio::common::V4_0::AudioFormat;
using ::android::hardware::audio::V4_0::IStream;
using ::android::hardware::audio::V4_0::ParameterValue;
using ::android::hardware::audio::V4_0::Result;
using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
using ::android::hardware::audio::CPP_VERSION::IStream;
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using ::android::hardware::audio::CPP_VERSION::Result;
using namespace ::android::hardware::audio::common::test::utility;
using Rotation = ::android::hardware::audio::V4_0::IPrimaryDevice::Rotation;
using ::android::hardware::audio::common::V4_0::AudioContentType;
using ::android::hardware::audio::common::V4_0::AudioUsage;
using ::android::hardware::audio::V4_0::MicrophoneInfo;
using ::android::hardware::audio::V4_0::SinkMetadata;
using ::android::hardware::audio::V4_0::SourceMetadata;
using Rotation = ::android::hardware::audio::CPP_VERSION::IPrimaryDevice::Rotation;
using ::android::hardware::audio::common::CPP_VERSION::AudioContentType;
using ::android::hardware::audio::common::CPP_VERSION::AudioUsage;
using ::android::hardware::audio::CPP_VERSION::MicrophoneInfo;
using ::android::hardware::audio::CPP_VERSION::SinkMetadata;
using ::android::hardware::audio::CPP_VERSION::SourceMetadata;
struct Parameters {
template <class T, class ReturnIn>

View File

@@ -14,6 +14,35 @@
// limitations under the License.
//
cc_test {
name: "VtsHalAudioV2_0TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
srcs: [
"2.0/AudioPrimaryHidlHalTest.cpp",
"ValidateAudioConfiguration.cpp"
],
static_libs: [
"android.hardware.audio.common.test.utility",
"android.hardware.audio@2.0",
"android.hardware.audio.common@2.0",
"libicuuc",
"libicuuc_stubdata",
"libxml2",
],
shared_libs: [
"libfmq",
],
header_libs: [
"android.hardware.audio.common.util@all-versions",
],
test_suites: ["general-tests"],
cflags: [
"-DMAJOR_VERSION=2",
"-DMINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
]
}
cc_test {
name: "VtsHalAudioV4_0TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
@@ -36,4 +65,9 @@ cc_test {
"android.hardware.audio.common.util@all-versions",
],
test_suites: ["general-tests"],
cflags: [
"-DMAJOR_VERSION=4",
"-DMINOR_VERSION=0",
"-include common/all-versions/VersionMacro.h",
]
}

View File

@@ -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>
@@ -35,11 +35,11 @@
#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 <fmq/EventFlag.h>
#include <fmq/MessageQueue.h>
@@ -48,12 +48,15 @@
#include "utility/AssertOk.h"
#include "utility/Documentation.h"
#include "utility/EnvironmentTearDown.h"
#define AUDIO_HAL_VERSION V2_0
#include "utility/PrettyPrintAudioTypes.h"
#include "utility/ReturnIn.h"
/** Provide version specific functions that are used in the generic tests */
#if MAJOR_VERSION == 2
#include "2.0/AudioPrimaryHidlHalUtils.h"
#elif MAJOR_VERSION == 4
#include "4.0/AudioPrimaryHidlHalUtils.h"
#endif
using std::initializer_list;
using std::list;
@@ -73,38 +76,38 @@ using ::android::hardware::kSynchronizedReadWrite;
using ::android::hardware::MessageQueue;
using ::android::hardware::MQDescriptorSync;
using ::android::hardware::Return;
using ::android::hardware::audio::V2_0::AudioDrain;
using ::android::hardware::audio::V2_0::DeviceAddress;
using ::android::hardware::audio::V2_0::IDevice;
using ::android::hardware::audio::V2_0::IPrimaryDevice;
using TtyMode = ::android::hardware::audio::V2_0::IPrimaryDevice::TtyMode;
using ::android::hardware::audio::V2_0::IDevicesFactory;
using ::android::hardware::audio::V2_0::IStream;
using ::android::hardware::audio::V2_0::IStreamIn;
using ::android::hardware::audio::V2_0::MessageQueueFlagBits;
using ::android::hardware::audio::V2_0::TimeSpec;
using ReadParameters = ::android::hardware::audio::V2_0::IStreamIn::ReadParameters;
using ReadStatus = ::android::hardware::audio::V2_0::IStreamIn::ReadStatus;
using ::android::hardware::audio::CPP_VERSION::AudioDrain;
using ::android::hardware::audio::CPP_VERSION::DeviceAddress;
using ::android::hardware::audio::CPP_VERSION::IDevice;
using ::android::hardware::audio::CPP_VERSION::IPrimaryDevice;
using TtyMode = ::android::hardware::audio::CPP_VERSION::IPrimaryDevice::TtyMode;
using ::android::hardware::audio::CPP_VERSION::IDevicesFactory;
using ::android::hardware::audio::CPP_VERSION::IStream;
using ::android::hardware::audio::CPP_VERSION::IStreamIn;
using ::android::hardware::audio::CPP_VERSION::MessageQueueFlagBits;
using ::android::hardware::audio::CPP_VERSION::TimeSpec;
using ReadParameters = ::android::hardware::audio::CPP_VERSION::IStreamIn::ReadParameters;
using ReadStatus = ::android::hardware::audio::CPP_VERSION::IStreamIn::ReadStatus;
using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
using ::android::hardware::audio::common::CPP_VERSION::AudioConfig;
using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
using ::android::hardware::audio::common::CPP_VERSION::AudioHandleConsts;
using ::android::hardware::audio::common::CPP_VERSION::AudioHwSync;
using ::android::hardware::audio::common::CPP_VERSION::AudioInputFlag;
using ::android::hardware::audio::common::CPP_VERSION::AudioIoHandle;
using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
using ::android::hardware::audio::common::CPP_VERSION::AudioOffloadInfo;
using ::android::hardware::audio::common::CPP_VERSION::AudioOutputFlag;
using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
using ::android::hardware::audio::common::CPP_VERSION::ThreadInfo;
using ::android::hardware::audio::common::utils::mkEnumBitfield;
using ::android::hardware::audio::common::V2_0::AudioChannelMask;
using ::android::hardware::audio::common::V2_0::AudioConfig;
using ::android::hardware::audio::common::V2_0::AudioDevice;
using ::android::hardware::audio::common::V2_0::AudioFormat;
using ::android::hardware::audio::common::V2_0::AudioHandleConsts;
using ::android::hardware::audio::common::V2_0::AudioHwSync;
using ::android::hardware::audio::common::V2_0::AudioInputFlag;
using ::android::hardware::audio::common::V2_0::AudioIoHandle;
using ::android::hardware::audio::common::V2_0::AudioMode;
using ::android::hardware::audio::common::V2_0::AudioOffloadInfo;
using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
using ::android::hardware::audio::common::V2_0::AudioSource;
using ::android::hardware::audio::common::V2_0::ThreadInfo;
using ::android::hardware::audio::V2_0::IStreamOut;
using ::android::hardware::audio::V2_0::IStreamOutCallback;
using ::android::hardware::audio::V2_0::MmapBufferInfo;
using ::android::hardware::audio::V2_0::MmapPosition;
using ::android::hardware::audio::V2_0::ParameterValue;
using ::android::hardware::audio::V2_0::Result;
using ::android::hardware::audio::CPP_VERSION::IStreamOut;
using ::android::hardware::audio::CPP_VERSION::IStreamOutCallback;
using ::android::hardware::audio::CPP_VERSION::MmapBufferInfo;
using ::android::hardware::audio::CPP_VERSION::MmapPosition;
using ::android::hardware::audio::CPP_VERSION::ParameterValue;
using ::android::hardware::audio::CPP_VERSION::Result;
using namespace ::android::hardware::audio::common::test::utility;
@@ -163,7 +166,11 @@ TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) {
doc::test("Test passing an invalid parameter to openDevice");
Result result;
sp<IDevice> device;
#if MAJOR_VERSION == 2
auto invalidDevice = IDevicesFactory::Device(-1);
#elif MAJOR_VERSION == 4
auto invalidDevice = "Non existing device";
#endif
ASSERT_OK(devicesFactory->openDevice(invalidDevice, returnIn(result, device)));
ASSERT_EQ(Result::INVALID_ARGUMENTS, result);
ASSERT_TRUE(device == nullptr);
@@ -194,13 +201,19 @@ class AudioPrimaryHidlTest : public AudioHidlTest {
private:
void initPrimaryDevice() {
Result result;
#if MAJOR_VERSION == 2
sp<IDevice> baseDevice;
ASSERT_OK(devicesFactory->openDevice(IDevicesFactory::Device::PRIMARY,
returnIn(result, baseDevice)));
#elif MAJOR_VERSION == 4
ASSERT_OK(devicesFactory->openPrimaryDevice(returnIn(result, device)));
#endif
ASSERT_OK(result);
#if MAJOR_VERSION == 2
ASSERT_TRUE(baseDevice != nullptr);
device = IPrimaryDevice::castFrom(baseDevice);
#endif
}
};
sp<IPrimaryDevice> AudioPrimaryHidlTest::device;
@@ -609,10 +622,22 @@ class OutputStreamTest : public OpenStreamTest<IStreamOut> {
auto flags = mkEnumBitfield(AudioOutputFlag::NONE);
testOpen(
[&](AudioIoHandle handle, AudioConfig config, auto cb) {
#if MAJOR_VERSION == 2
return device->openOutputStream(handle, address, config, flags, cb);
#elif MAJOR_VERSION == 4
return device->openOutputStream(handle, address, config, flags, initMetadata, cb);
#endif
},
config);
}
#if MAJOR_VERSION == 4
protected:
const SourceMetadata initMetadata = {
{ { AudioUsage::MEDIA,
AudioContentType::MUSIC,
1 /* gain */ } }};
#endif
};
TEST_P(OutputStreamTest, OpenOutputStreamTest) {
doc::test(
@@ -651,7 +676,11 @@ class InputStreamTest : public OpenStreamTest<IStreamIn> {
}
protected:
#if MAJOR_VERSION == 2
const AudioSource initMetadata = AudioSource::DEFAULT;
#elif MAJOR_VERSION == 4
const SinkMetadata initMetadata = {{{AudioSource::DEFAULT, 1 /* gain */}}};
#endif
};
TEST_P(InputStreamTest, OpenInputStreamTest) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2017 The Android Open Source Project
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,15 +23,12 @@
#define QUOTE(x) #x
#define STRINGIFY(x) QUOTE(x)
#define AUDIO_HAL_VERSION V4_0
TEST(CheckConfig, audioPolicyConfigurationValidation) {
RecordProperty("description",
"Verify that the audio policy configuration file "
"is valid according to the schema");
std::vector<const char*> locations = {"/odm/etc", "/vendor/etc", "/system/etc"};
const char* xsd =
"/data/local/tmp/audio_policy_configuration_" STRINGIFY(AUDIO_HAL_VERSION) ".xsd";
const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd";
EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("audio_policy_configuration.xml", locations, xsd);
}

View File

@@ -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

View File

@@ -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

View File

@@ -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",
],
}

View File

@@ -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

View File

@@ -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_

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

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