Merge "Define CBRS HAL interfaces in IRadio 1.3 and IRadioConfig 1.1."
diff --git a/Android.bp b/Android.bp
index 05ca928..1c6e1b2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,6 @@
hidl_package_root {
name: "android.hardware",
+ use_current: true,
}
cc_defaults {
diff --git a/atrace/1.0/vts/functional/Android.bp b/atrace/1.0/vts/functional/Android.bp
index 6b50fb5..d3f4276 100644
--- a/atrace/1.0/vts/functional/Android.bp
+++ b/atrace/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalAtraceV1_0TargetTest.cpp"],
static_libs: ["android.hardware.atrace@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/audio/README b/audio/README
index 1f1e8e3..abe979c 100644
--- a/audio/README
+++ b/audio/README
@@ -1,48 +1,33 @@
Directory structure of the audio HIDL related code.
audio
-|-- 2.0 <== HIDL (.hal) can not be moved to fit the directory structure
-| because that would create a separate HAL
+|-- 2.0 <== core 2.0 HIDL API. .hal can not be moved into the core directory
+| because that would change its namespace and include path
|-- 4.0 <== Version 4.0 of the core API
|
-|-- common <== code common to audio core and effect API
-| |-- 2.0
-| | |-- default <== code that wraps the legacy API
-| | `-- vts <== vts of 2.0 core and effect API common code
-| |-- 4.0
-| | |-- default
-| | `-- vts
-| |-- ... <== The future versions should continue this structure
-| | |-- default
-| | `-- vts
-| `-- all_versions <== code common to all version of both core and effect API
-| |-- default
-| `-- vts <== vts of core and effect API common version independent code
+|-- ...
|
-|-- core <== code relative to the core API
-| |-- 2.0 <== 2.0 core API code (except .hal, see audio/2.0)
-| | |-- default
-| | `-- vts
+|-- common <== code common to audio core and effect API
+| |-- 2.0 <== HIDL API of V2
| |-- 4.0
-| | |-- default <== default implementation of the core 4.0 api
-| | `-- vts <== vts code of the 4.0 API
| |-- ...
-| | |-- default
-| | `-- vts
-| `-- all_versions
-| |-- default
-| `-- vts <== vts of core API common version independent code
+| `-- all_versions <== code common to all version of both core and effect API
+| |-- default <== implementation shared code between core and effect impl
+| |-- test <== utilities used by tests
+| `-- util <== utilities used by both implementation and tests
+|
+|-- core <== VTS and default implementation of the core API (not HIDL, see /audio/2.0))
+| `-- all_versions <== Code is version independent through #if and separate files
+| |-- default <== code that wraps the legacy API
+| `-- vts <== vts of core API
+| |-- 2.0 <== 2.0 specific tests and helpers
+| |-- 4.0
+| |-- ...
|
`-- effect <== idem for the effect API
|-- 2.0
- | |-- default
- | `-- vts
|-- 4.0
- | |-- default
- | `-- vts
|-- ...
- | |-- default
- | `-- vts
`-- all_versions
|-- default
`-- vts
diff --git a/audio/common/2.0/default/Android.bp b/audio/common/2.0/default/Android.bp
deleted file mode 100644
index ac66479..0000000
--- a/audio/common/2.0/default/Android.bp
+++ /dev/null
@@ -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",
- ],
-}
diff --git a/audio/common/2.0/default/HidlUtils.cpp b/audio/common/2.0/default/HidlUtils.cpp
deleted file mode 100644
index 9771b7b..0000000
--- a/audio/common/2.0/default/HidlUtils.cpp
+++ /dev/null
@@ -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
diff --git a/audio/common/2.0/default/HidlUtils.h b/audio/common/2.0/default/HidlUtils.h
deleted file mode 100644
index 24543b1..0000000
--- a/audio/common/2.0/default/HidlUtils.h
+++ /dev/null
@@ -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_
diff --git a/audio/common/2.0/default/VersionUtils.h b/audio/common/2.0/default/VersionUtils.h
deleted file mode 100644
index 60d1f9c..0000000
--- a/audio/common/2.0/default/VersionUtils.h
+++ /dev/null
@@ -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
diff --git a/audio/common/4.0/default/Android.bp b/audio/common/4.0/default/Android.bp
deleted file mode 100644
index 57b2e01..0000000
--- a/audio/common/4.0/default/Android.bp
+++ /dev/null
@@ -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",
- ],
-}
diff --git a/audio/common/4.0/default/HidlUtils.cpp b/audio/common/4.0/default/HidlUtils.cpp
deleted file mode 100644
index b66eff9..0000000
--- a/audio/common/4.0/default/HidlUtils.cpp
+++ /dev/null
@@ -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
diff --git a/audio/common/4.0/default/HidlUtils.h b/audio/common/4.0/default/HidlUtils.h
deleted file mode 100644
index 91e6a9e..0000000
--- a/audio/common/4.0/default/HidlUtils.h
+++ /dev/null
@@ -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_
diff --git a/audio/common/4.0/default/OWNERS b/audio/common/4.0/default/OWNERS
deleted file mode 100644
index 6fdc97c..0000000
--- a/audio/common/4.0/default/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-elaurent@google.com
-krocard@google.com
-mnaganov@google.com
diff --git a/audio/common/4.0/default/VersionUtils.h b/audio/common/4.0/default/VersionUtils.h
deleted file mode 100644
index b7f2aec..0000000
--- a/audio/common/4.0/default/VersionUtils.h
+++ /dev/null
@@ -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/4.0/types.h>
-
-namespace android {
-namespace hardware {
-namespace audio {
-namespace common {
-namespace V4_0 {
-namespace implementation {
-
-typedef hidl_bitfield<common::V4_0::AudioDevice> AudioDeviceBitfield;
-typedef hidl_bitfield<common::V4_0::AudioChannelMask> AudioChannelBitfield;
-typedef hidl_bitfield<common::V4_0::AudioOutputFlag> AudioOutputFlagBitfield;
-typedef hidl_bitfield<common::V4_0::AudioInputFlag> AudioInputFlagBitfield;
-
-} // namespace implementation
-} // namespace V4_0
-} // namespace common
-} // namespace audio
-} // namespace hardware
-} // namespace android
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
diff --git a/audio/common/all-versions/default/Android.bp b/audio/common/all-versions/default/Android.bp
index 4a27bb7..e062105 100644
--- a/audio/common/all-versions/default/Android.bp
+++ b/audio/common/all-versions/default/Android.bp
@@ -17,9 +17,6 @@
name: "android.hardware.audio.common-util",
defaults: ["hidl_defaults"],
vendor_available: true,
- vndk: {
- enabled: true,
- },
srcs: [
"EffectMap.cpp",
],
@@ -41,3 +38,58 @@
"android.hardware.audio.common.util@all-versions",
]
}
+
+cc_defaults {
+ name: "android.hardware.audio.common-util_default",
+ defaults: ["hidl_defaults"],
+
+ vendor_available: true,
+ srcs: [
+ "HidlUtils.cpp",
+ ],
+
+ export_include_dirs: ["."],
+
+ shared_libs: [
+ "liblog",
+ "libutils",
+ "libhidlbase",
+ "android.hardware.audio.common-util",
+ ],
+ export_shared_lib_headers: [
+ "android.hardware.audio.common-util"
+ ],
+
+ header_libs: [
+ "libaudio_system_headers",
+ "libhardware_headers",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.audio.common@2.0-util",
+ defaults: ["android.hardware.audio.common-util_default"],
+
+ shared_libs: [
+ "android.hardware.audio.common@2.0",
+ ],
+ cflags: [
+ "-DMAJOR_VERSION=2",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
+}
+
+cc_library_shared {
+ name: "android.hardware.audio.common@4.0-util",
+ defaults: ["android.hardware.audio.common-util_default"],
+
+ shared_libs: [
+ "android.hardware.audio.common@4.0",
+ ],
+ cflags: [
+ "-DMAJOR_VERSION=4",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
+}
diff --git a/audio/common/all-versions/default/EffectMap.cpp b/audio/common/all-versions/default/EffectMap.cpp
index 7f8da1e..cb3e3d5 100644
--- a/audio/common/all-versions/default/EffectMap.cpp
+++ b/audio/common/all-versions/default/EffectMap.cpp
@@ -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.
diff --git a/audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.impl.h b/audio/common/all-versions/default/HidlUtils.cpp
similarity index 88%
rename from audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.impl.h
rename to audio/common/all-versions/default/HidlUtils.cpp
index 632e816..5ed059c 100644
--- a/audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.impl.h
+++ b/audio/common/all-versions/default/HidlUtils.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,36 +14,34 @@
* 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::mkEnumConverter;
+using ::android::hardware::audio::common::utils::EnumBitfield;
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;
- config->channelMask = mkEnumConverter<AudioChannelMask>(halConfig.channel_mask);
+ config->channelMask = EnumBitfield<AudioChannelMask>(halConfig.channel_mask);
config->format = AudioFormat(halConfig.format);
audioOffloadInfoFromHal(halConfig.offload_info, &config->offloadInfo);
config->frameCount = halConfig.frame_count;
@@ -61,8 +59,8 @@
void HidlUtils::audioGainConfigFromHal(const struct audio_gain_config& halConfig,
AudioGainConfig* config) {
config->index = halConfig.index;
- config->mode = mkEnumConverter<AudioGainMode>(halConfig.mode);
- config->channelMask = mkEnumConverter<AudioChannelMask>(halConfig.channel_mask);
+ config->mode = EnumBitfield<AudioGainMode>(halConfig.mode);
+ config->channelMask = EnumBitfield<AudioChannelMask>(halConfig.channel_mask);
for (size_t i = 0; i < sizeof(audio_channel_mask_t) * 8; ++i) {
config->values[i] = halConfig.values[i];
}
@@ -82,8 +80,8 @@
}
void HidlUtils::audioGainFromHal(const struct audio_gain& halGain, AudioGain* gain) {
- gain->mode = mkEnumConverter<AudioGainMode>(halGain.mode);
- gain->channelMask = mkEnumConverter<AudioChannelMask>(halGain.channel_mask);
+ gain->mode = EnumBitfield<AudioGainMode>(halGain.mode);
+ gain->channelMask = EnumBitfield<AudioChannelMask>(halGain.channel_mask);
gain->minValue = halGain.min_value;
gain->maxValue = halGain.max_value;
gain->defaultValue = halGain.default_value;
@@ -122,7 +120,7 @@
void HidlUtils::audioOffloadInfoFromHal(const audio_offload_info_t& halOffload,
AudioOffloadInfo* offload) {
offload->sampleRateHz = halOffload.sample_rate;
- offload->channelMask = mkEnumConverter<AudioChannelMask>(halOffload.channel_mask);
+ offload->channelMask = EnumBitfield<AudioChannelMask>(halOffload.channel_mask);
offload->format = AudioFormat(halOffload.format);
offload->streamType = AudioStreamType(halOffload.stream_type);
offload->bitRatePerSecond = halOffload.bit_rate;
@@ -155,9 +153,9 @@
config->id = halConfig.id;
config->role = AudioPortRole(halConfig.role);
config->type = AudioPortType(halConfig.type);
- config->configMask = mkEnumConverter<AudioPortConfigMask>(halConfig.config_mask);
+ config->configMask = EnumBitfield<AudioPortConfigMask>(halConfig.config_mask);
config->sampleRateHz = halConfig.sample_rate;
- config->channelMask = mkEnumConverter<AudioChannelMask>(halConfig.channel_mask);
+ config->channelMask = EnumBitfield<AudioChannelMask>(halConfig.channel_mask);
config->format = AudioFormat(halConfig.format);
audioGainConfigFromHal(halConfig.gain, &config->gain);
switch (halConfig.type) {
@@ -257,7 +255,7 @@
}
port->channelMasks.resize(halPort.num_channel_masks);
for (size_t i = 0; i < halPort.num_channel_masks; ++i) {
- port->channelMasks[i] = mkEnumConverter<AudioChannelMask>(halPort.channel_masks[i]);
+ port->channelMasks[i] = EnumBitfield<AudioChannelMask>(halPort.channel_masks[i]);
}
port->formats.resize(halPort.num_formats);
for (size_t i = 0; i < halPort.num_formats; ++i) {
@@ -358,7 +356,7 @@
memcpy(halUuid->node, uuid.node.data(), uuid.node.size());
}
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace common
} // namespace audio
} // namespace hardware
diff --git a/audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.h b/audio/common/all-versions/default/HidlUtils.h
similarity index 78%
rename from audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.h
rename to audio/common/all-versions/default/HidlUtils.h
index f9a5697..77c8b89 100644
--- a/audio/common/all-versions/default/include/common/all-versions/default/HidlUtils.h
+++ b/audio/common/all-versions/default/HidlUtils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,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::audio::common::AUDIO_HAL_VERSION::AudioConfig;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGain;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioGainConfig;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOffloadInfo;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid;
using ::android::hardware::hidl_vec;
+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 @@
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_
diff --git a/audio/common/2.0/default/OWNERS b/audio/common/all-versions/default/OWNERS
similarity index 100%
rename from audio/common/2.0/default/OWNERS
rename to audio/common/all-versions/default/OWNERS
diff --git a/audio/common/all-versions/default/VersionUtils.h b/audio/common/all-versions/default/VersionUtils.h
new file mode 100644
index 0000000..4726b5b
--- /dev/null
+++ b/audio/common/all-versions/default/VersionUtils.h
@@ -0,0 +1,48 @@
+/*
+ * 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 PATH(android/hardware/audio/common/FILE_VERSION/types.h)
+
+namespace android {
+namespace hardware {
+namespace audio {
+namespace common {
+namespace CPP_VERSION {
+namespace implementation {
+
+#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 CPP_VERSION
+} // namespace common
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_VERSION_UTILS_H
diff --git a/audio/common/all-versions/default/include/common/all-versions/default/EffectMap.h b/audio/common/all-versions/default/include/common/all-versions/default/EffectMap.h
index 547c6d5..7f630bf 100644
--- a/audio/common/all-versions/default/include/common/all-versions/default/EffectMap.h
+++ b/audio/common/all-versions/default/include/common/all-versions/default/EffectMap.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/audio/common/all-versions/test/utility/include/utility/AssertOk.h b/audio/common/all-versions/test/utility/include/utility/AssertOk.h
index 11e1c24..5ac2fdc 100644
--- a/audio/common/all-versions/test/utility/include/utility/AssertOk.h
+++ b/audio/common/all-versions/test/utility/include/utility/AssertOk.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/audio/common/all-versions/test/utility/include/utility/Documentation.h b/audio/common/all-versions/test/utility/include/utility/Documentation.h
index e10cf79..1b555b9 100644
--- a/audio/common/all-versions/test/utility/include/utility/Documentation.h
+++ b/audio/common/all-versions/test/utility/include/utility/Documentation.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h b/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h
index 7a08a54..0e416f3 100644
--- a/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h
+++ b/audio/common/all-versions/test/utility/include/utility/EnvironmentTearDown.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h
index abc2ff5..3833fd0 100644
--- a/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h
+++ b/audio/common/all-versions/test/utility/include/utility/PrettyPrintAudioTypes.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,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 @@
#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
diff --git a/audio/common/all-versions/test/utility/include/utility/ReturnIn.h b/audio/common/all-versions/test/utility/include/utility/ReturnIn.h
index 7fd0d4a..de16809 100644
--- a/audio/common/all-versions/test/utility/include/utility/ReturnIn.h
+++ b/audio/common/all-versions/test/utility/include/utility/ReturnIn.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h
index 91adfc1..ee206f7 100644
--- a/audio/common/all-versions/test/utility/include/utility/ValidateXml.h
+++ b/audio/common/all-versions/test/utility/include/utility/ValidateXml.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/audio/common/all-versions/test/utility/src/ValidateXml.cpp b/audio/common/all-versions/test/utility/src/ValidateXml.cpp
index 1a906d6..bdafa82 100644
--- a/audio/common/all-versions/test/utility/src/ValidateXml.cpp
+++ b/audio/common/all-versions/test/utility/src/ValidateXml.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -162,8 +162,8 @@
<< "\n Which is: " << xmlFileName
<< "\n In the following folders: " << xmlFileLocationsExpr
<< "\n Which is: " << ::testing::PrintToString(xmlFileLocations)
- << (atLeastOneRequired ? "Where at least one file must be found."
- : "Where no file might exist.");
+ << (atLeastOneRequired ? "\nWhere at least one file must be found."
+ : "\nWhere no file might exist.");
}
template ::testing::AssertionResult validateXmlMultipleLocations<true>(const char*, const char*,
diff --git a/audio/common/all-versions/util/Android.bp b/audio/common/all-versions/util/Android.bp
index 5d33a3a..3c7e62e 100644
--- a/audio/common/all-versions/util/Android.bp
+++ b/audio/common/all-versions/util/Android.bp
@@ -2,9 +2,6 @@
name: "android.hardware.audio.common.util@all-versions",
defaults: ["hidl_defaults"],
vendor_available: true,
- vndk: {
- enabled: true,
- },
export_include_dirs: ["include"],
}
diff --git a/audio/common/all-versions/util/include/common/all-versions/IncludeGuard.h b/audio/common/all-versions/util/include/common/all-versions/IncludeGuard.h
deleted file mode 100644
index 2d54816..0000000
--- a/audio/common/all-versions/util/include/common/all-versions/IncludeGuard.h
+++ /dev/null
@@ -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
diff --git a/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h b/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h
new file mode 100644
index 0000000..dc54cee
--- /dev/null
+++ b/audio/common/all-versions/util/include/common/all-versions/VersionMacro.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_VERSION_MACRO_H
+#define ANDROID_HARDWARE_VERSION_MACRO_H
+
+#if !defined(MAJOR_VERSION) || !defined(MINOR_VERSION)
+#error "MAJOR_VERSION and MINOR_VERSION must be defined"
+#endif
+
+/** Allows macro expansion for x and add surrounding `<>`.
+ * Is intended to be used for version dependant includes as
+ * `#include` do not macro expand if starting with < or "
+ * Example usage:
+ * #include PATH(path/to/FILE_VERSION/file)
+ * @note: uses the implementation-define "Computed Includes" feature.
+ */
+#define PATH(x) <x>
+
+#define CONCAT_3(a, b, c) a##b##c
+#define EXPAND_CONCAT_3(a, b, c) CONCAT_3(a, b, c)
+/** The directory name of the version: <major>.<minor> */
+#define FILE_VERSION EXPAND_CONCAT_3(MAJOR_VERSION, ., MINOR_VERSION)
+
+#define CONCAT_4(a, b, c, d) a##b##c##d
+#define EXPAND_CONCAT_4(a, b, c, d) CONCAT_4(a, b, c, d)
+/** The c++ namespace of the version: V<major>_<minor> */
+#define CPP_VERSION EXPAND_CONCAT_4(V, MAJOR_VERSION, _, MINOR_VERSION)
+
+#endif // ANDROID_HARDWARE_VERSION_MACRO_H
diff --git a/audio/common/all-versions/util/include/common/all-versions/VersionUtils.h b/audio/common/all-versions/util/include/common/all-versions/VersionUtils.h
index 70c3d56..3b5c0fb 100644
--- a/audio/common/all-versions/util/include/common/all-versions/VersionUtils.h
+++ b/audio/common/all-versions/util/include/common/all-versions/VersionUtils.h
@@ -26,36 +26,31 @@
namespace common {
namespace utils {
-/** Similar to static_cast but also casts to hidl_bitfield depending on
- * return type inference (emulated through user-define conversion).
- */
-template <class Source, class Destination = Source>
-class EnumConverter {
+/** Converting between a bitfield or itself. */
+template <class Enum>
+class EnumBitfield {
public:
- static_assert(std::is_enum<Source>::value || std::is_enum<Destination>::value,
- "Source or destination should be an enum");
+ using Bitfield = ::android::hardware::hidl_bitfield<Enum>;
- explicit EnumConverter(Source source) : mSource(source) {}
+ EnumBitfield(const EnumBitfield&) = default;
+ explicit EnumBitfield(Enum value) : mValue(value) {}
+ explicit EnumBitfield(Bitfield value) : EnumBitfield(static_cast<Enum>(value)) {}
- operator Destination() const { return static_cast<Destination>(mSource); }
+ EnumBitfield& operator=(const EnumBitfield&) = default;
+ EnumBitfield& operator=(Enum value) { return *this = EnumBitfield{value}; }
+ EnumBitfield& operator=(Bitfield value) { return *this = EnumBitfield{value}; }
- template <class = std::enable_if_t<std::is_enum<Destination>::value>>
- operator ::android::hardware::hidl_bitfield<Destination>() {
- return static_cast<std::underlying_type_t<Destination>>(mSource);
- }
+ operator Enum() const { return mValue; }
+ operator Bitfield() const { return static_cast<Bitfield>(mValue); }
private:
- const Source mSource;
+ Enum mValue;
};
-template <class Destination, class Source>
-auto mkEnumConverter(Source source) {
- return EnumConverter<Source, Destination>{source};
-}
-/** Allows converting an enum to its bitfield or itself. */
+/** ATD way to create a EnumBitfield. */
template <class Enum>
-EnumConverter<Enum> mkBitfield(Enum value) {
- return EnumConverter<Enum>{value};
+EnumBitfield<Enum> mkEnumBitfield(Enum value) {
+ return EnumBitfield<Enum>{value};
}
} // namespace utils
diff --git a/audio/core/2.0/default/Android.bp b/audio/core/2.0/default/Android.bp
deleted file mode 100644
index 625df74..0000000
--- a/audio/core/2.0/default/Android.bp
+++ /dev/null
@@ -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",
- ],
-
-}
diff --git a/audio/core/2.0/default/Conversions.cpp b/audio/core/2.0/default/Conversions.cpp
deleted file mode 100644
index 6c32090..0000000
--- a/audio/core/2.0/default/Conversions.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/Device.cpp b/audio/core/2.0/default/Device.cpp
deleted file mode 100644
index b67203d..0000000
--- a/audio/core/2.0/default/Device.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/DevicesFactory.cpp b/audio/core/2.0/default/DevicesFactory.cpp
deleted file mode 100644
index 65a9ccd..0000000
--- a/audio/core/2.0/default/DevicesFactory.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/OWNERS b/audio/core/2.0/default/OWNERS
deleted file mode 100644
index 6fdc97c..0000000
--- a/audio/core/2.0/default/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-elaurent@google.com
-krocard@google.com
-mnaganov@google.com
diff --git a/audio/core/2.0/default/ParametersUtil.cpp b/audio/core/2.0/default/ParametersUtil.cpp
deleted file mode 100644
index 963e291..0000000
--- a/audio/core/2.0/default/ParametersUtil.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "core/2.0/default/ParametersUtil.h"
-#include "core/2.0/default/Util.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <core/all-versions/default/ParametersUtil.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/core/2.0/default/PrimaryDevice.cpp b/audio/core/2.0/default/PrimaryDevice.cpp
deleted file mode 100644
index decaa14..0000000
--- a/audio/core/2.0/default/PrimaryDevice.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/Stream.cpp b/audio/core/2.0/default/Stream.cpp
deleted file mode 100644
index 0863a7c..0000000
--- a/audio/core/2.0/default/Stream.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/StreamIn.cpp b/audio/core/2.0/default/StreamIn.cpp
deleted file mode 100644
index 2021df1..0000000
--- a/audio/core/2.0/default/StreamIn.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "StreamInHAL"
-
-#include "core/2.0/default/StreamIn.h"
-#include "core/2.0/default/Util.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <core/all-versions/default/StreamIn.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/core/2.0/default/StreamOut.cpp b/audio/core/2.0/default/StreamOut.cpp
deleted file mode 100644
index 940a251..0000000
--- a/audio/core/2.0/default/StreamOut.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/include/core/2.0/default/Conversions.h b/audio/core/2.0/default/include/core/2.0/default/Conversions.h
deleted file mode 100644
index b3a6ea8..0000000
--- a/audio/core/2.0/default/include/core/2.0/default/Conversions.h
+++ /dev/null
@@ -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_
diff --git a/audio/core/2.0/default/include/core/2.0/default/Device.h b/audio/core/2.0/default/include/core/2.0/default/Device.h
deleted file mode 100644
index 3ec7464..0000000
--- a/audio/core/2.0/default/include/core/2.0/default/Device.h
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/include/core/2.0/default/DevicesFactory.h b/audio/core/2.0/default/include/core/2.0/default/DevicesFactory.h
deleted file mode 100644
index 8e8ee88..0000000
--- a/audio/core/2.0/default/include/core/2.0/default/DevicesFactory.h
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/include/core/2.0/default/ParametersUtil.h b/audio/core/2.0/default/include/core/2.0/default/ParametersUtil.h
deleted file mode 100644
index a5c1c78..0000000
--- a/audio/core/2.0/default/include/core/2.0/default/ParametersUtil.h
+++ /dev/null
@@ -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_
diff --git a/audio/core/2.0/default/include/core/2.0/default/PrimaryDevice.h b/audio/core/2.0/default/include/core/2.0/default/PrimaryDevice.h
deleted file mode 100644
index f898597..0000000
--- a/audio/core/2.0/default/include/core/2.0/default/PrimaryDevice.h
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/include/core/2.0/default/Stream.h b/audio/core/2.0/default/include/core/2.0/default/Stream.h
deleted file mode 100644
index a2d8456..0000000
--- a/audio/core/2.0/default/include/core/2.0/default/Stream.h
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/include/core/2.0/default/StreamIn.h b/audio/core/2.0/default/include/core/2.0/default/StreamIn.h
deleted file mode 100644
index c36abbd..0000000
--- a/audio/core/2.0/default/include/core/2.0/default/StreamIn.h
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/include/core/2.0/default/StreamOut.h b/audio/core/2.0/default/include/core/2.0/default/StreamOut.h
deleted file mode 100644
index ab35687..0000000
--- a/audio/core/2.0/default/include/core/2.0/default/StreamOut.h
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/default/include/core/2.0/default/Util.h b/audio/core/2.0/default/include/core/2.0/default/Util.h
deleted file mode 100644
index 1f0e284..0000000
--- a/audio/core/2.0/default/include/core/2.0/default/Util.h
+++ /dev/null
@@ -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
diff --git a/audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
deleted file mode 100644
index a08a2d6..0000000
--- a/audio/core/2.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ /dev/null
@@ -1,1280 +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 "VtsHalAudioV2_0TargetTest"
-
-#include <algorithm>
-#include <cmath>
-#include <cstddef>
-#include <cstdio>
-#include <initializer_list>
-#include <limits>
-#include <string>
-#include <vector>
-
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <VtsHalHidlTargetTestBase.h>
-
-#include <android-base/logging.h>
-
-#include <android/hardware/audio/2.0/IDevice.h>
-#include <android/hardware/audio/2.0/IDevicesFactory.h>
-#include <android/hardware/audio/2.0/IPrimaryDevice.h>
-#include <android/hardware/audio/2.0/types.h>
-#include <android/hardware/audio/common/2.0/types.h>
-
-#include "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"
-
-using std::initializer_list;
-using std::string;
-using std::to_string;
-using std::vector;
-
-using ::android::sp;
-using ::android::hardware::Return;
-using ::android::hardware::hidl_handle;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::MQDescriptorSync;
-using ::android::hardware::audio::V2_0::AudioDrain;
-using ::android::hardware::audio::V2_0::DeviceAddress;
-using ::android::hardware::audio::V2_0::IDevice;
-using ::android::hardware::audio::V2_0::IPrimaryDevice;
-using TtyMode = ::android::hardware::audio::V2_0::IPrimaryDevice::TtyMode;
-using ::android::hardware::audio::V2_0::IDevicesFactory;
-using ::android::hardware::audio::V2_0::IStream;
-using ::android::hardware::audio::V2_0::IStreamIn;
-using ::android::hardware::audio::V2_0::TimeSpec;
-using ReadParameters = ::android::hardware::audio::V2_0::IStreamIn::ReadParameters;
-using ReadStatus = ::android::hardware::audio::V2_0::IStreamIn::ReadStatus;
-using ::android::hardware::audio::V2_0::IStreamOut;
-using ::android::hardware::audio::V2_0::IStreamOutCallback;
-using ::android::hardware::audio::V2_0::MmapBufferInfo;
-using ::android::hardware::audio::V2_0::MmapPosition;
-using ::android::hardware::audio::V2_0::ParameterValue;
-using ::android::hardware::audio::V2_0::Result;
-using ::android::hardware::audio::common::V2_0::AudioChannelMask;
-using ::android::hardware::audio::common::V2_0::AudioConfig;
-using ::android::hardware::audio::common::V2_0::AudioDevice;
-using ::android::hardware::audio::common::V2_0::AudioFormat;
-using ::android::hardware::audio::common::V2_0::AudioHandleConsts;
-using ::android::hardware::audio::common::V2_0::AudioInputFlag;
-using ::android::hardware::audio::common::V2_0::AudioIoHandle;
-using ::android::hardware::audio::common::V2_0::AudioMode;
-using ::android::hardware::audio::common::V2_0::AudioOffloadInfo;
-using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
-using ::android::hardware::audio::common::V2_0::AudioSource;
-using ::android::hardware::audio::common::V2_0::ThreadInfo;
-
-using namespace ::android::hardware::audio::common::test::utility;
-
-class AudioHidlTestEnvironment : public ::Environment {
- public:
- virtual void registerTestServices() override { registerTestService<IDevicesFactory>(); }
-};
-
-// Instance to register global tearDown
-static AudioHidlTestEnvironment* environment;
-
-class HidlTest : public ::testing::VtsHalHidlTargetTestBase {
- protected:
- // Convenient member to store results
- Result res;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-////////////////////// getService audio_devices_factory //////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-// Test all audio devices
-class AudioHidlTest : public HidlTest {
- public:
- void SetUp() override {
- ASSERT_NO_FATAL_FAILURE(HidlTest::SetUp()); // setup base
-
- if (devicesFactory == nullptr) {
- environment->registerTearDown([] { devicesFactory.clear(); });
- devicesFactory = ::testing::VtsHalHidlTargetTestBase::getService<IDevicesFactory>(
- environment->getServiceName<IDevicesFactory>("default"));
- }
- ASSERT_TRUE(devicesFactory != nullptr);
- }
-
- protected:
- // Cache the devicesFactory retrieval to speed up each test by ~0.5s
- static sp<IDevicesFactory> devicesFactory;
-};
-sp<IDevicesFactory> AudioHidlTest::devicesFactory;
-
-TEST_F(AudioHidlTest, GetAudioDevicesFactoryService) {
- doc::test("test the getService (called in SetUp)");
-}
-
-TEST_F(AudioHidlTest, OpenDeviceInvalidParameter) {
- doc::test("test passing an invalid parameter to openDevice");
- IDevicesFactory::Result result;
- sp<IDevice> device;
- ASSERT_OK(devicesFactory->openDevice(IDevicesFactory::Device(-1), returnIn(result, device)));
- ASSERT_EQ(IDevicesFactory::Result::INVALID_ARGUMENTS, result);
- ASSERT_TRUE(device == nullptr);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-/////////////////////////////// openDevice primary ///////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-// Test the primary device
-class AudioPrimaryHidlTest : public AudioHidlTest {
- public:
- /** Primary HAL test are NOT thread safe. */
- void SetUp() override {
- ASSERT_NO_FATAL_FAILURE(AudioHidlTest::SetUp()); // setup base
-
- if (device == nullptr) {
- IDevicesFactory::Result result;
- sp<IDevice> baseDevice;
- ASSERT_OK(devicesFactory->openDevice(IDevicesFactory::Device::PRIMARY,
- returnIn(result, baseDevice)));
- ASSERT_OK(result);
- ASSERT_TRUE(baseDevice != nullptr);
-
- environment->registerTearDown([] { device.clear(); });
- device = IPrimaryDevice::castFrom(baseDevice);
- ASSERT_TRUE(device != nullptr);
- }
- }
-
- protected:
- // Cache the device opening to speed up each test by ~0.5s
- static sp<IPrimaryDevice> device;
-};
-sp<IPrimaryDevice> AudioPrimaryHidlTest::device;
-
-TEST_F(AudioPrimaryHidlTest, OpenPrimaryDevice) {
- doc::test("Test the openDevice (called in SetUp)");
-}
-
-TEST_F(AudioPrimaryHidlTest, Init) {
- doc::test("Test that the audio primary hal initialized correctly");
- ASSERT_OK(device->initCheck());
-}
-
-//////////////////////////////////////////////////////////////////////////////
-///////////////////// {set,get}{Master,Mic}{Mute,Volume} /////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-template <class Property>
-class AccessorPrimaryHidlTest : public AudioPrimaryHidlTest {
- protected:
- /** Test a property getter and setter. */
- template <class Getter, class Setter>
- void testAccessors(const string& propertyName, const vector<Property>& valuesToTest,
- Setter setter, Getter getter, const vector<Property>& invalidValues = {}) {
- Property initialValue; // Save initial value to restore it at the end
- // of the test
- ASSERT_OK((device.get()->*getter)(returnIn(res, initialValue)));
- ASSERT_OK(res);
-
- for (Property setValue : valuesToTest) {
- SCOPED_TRACE("Test " + propertyName + " getter and setter for " +
- testing::PrintToString(setValue));
- ASSERT_OK((device.get()->*setter)(setValue));
- Property getValue;
- // Make sure the getter returns the same value just set
- ASSERT_OK((device.get()->*getter)(returnIn(res, getValue)));
- ASSERT_OK(res);
- EXPECT_EQ(setValue, getValue);
- }
-
- for (Property invalidValue : invalidValues) {
- SCOPED_TRACE("Try to set " + propertyName + " with the invalid value " +
- testing::PrintToString(invalidValue));
- EXPECT_RESULT(Result::INVALID_ARGUMENTS, (device.get()->*setter)(invalidValue));
- }
-
- ASSERT_OK((device.get()->*setter)(initialValue)); // restore initial value
- }
-
- /** Test the getter and setter of an optional feature. */
- template <class Getter, class Setter>
- void testOptionalAccessors(const string& propertyName, const vector<Property>& valuesToTest,
- Setter setter, Getter getter,
- const vector<Property>& invalidValues = {}) {
- doc::test("Test the optional " + propertyName + " getters and setter");
- {
- SCOPED_TRACE("Test feature support by calling the getter");
- Property initialValue;
- ASSERT_OK((device.get()->*getter)(returnIn(res, initialValue)));
- if (res == Result::NOT_SUPPORTED) {
- doc::partialTest(propertyName + " getter is not supported");
- return;
- }
- ASSERT_OK(res); // If it is supported it must succeed
- }
- // The feature is supported, test it
- testAccessors(propertyName, valuesToTest, setter, getter, invalidValues);
- }
-};
-
-using BoolAccessorPrimaryHidlTest = AccessorPrimaryHidlTest<bool>;
-
-TEST_F(BoolAccessorPrimaryHidlTest, MicMuteTest) {
- doc::test("Check that the mic can be muted and unmuted");
- testAccessors("mic mute", {true, false, true}, &IDevice::setMicMute, &IDevice::getMicMute);
- // TODO: check that the mic is really muted (all sample are 0)
-}
-
-TEST_F(BoolAccessorPrimaryHidlTest, MasterMuteTest) {
- doc::test(
- "If master mute is supported, try to mute and unmute the master "
- "output");
- testOptionalAccessors("master mute", {true, false, true}, &IDevice::setMasterMute,
- &IDevice::getMasterMute);
- // TODO: check that the master volume is really muted
-}
-
-using FloatAccessorPrimaryHidlTest = AccessorPrimaryHidlTest<float>;
-TEST_F(FloatAccessorPrimaryHidlTest, MasterVolumeTest) {
- doc::test("Test the master volume if supported");
- testOptionalAccessors(
- "master volume", {0, 0.5, 1}, &IDevice::setMasterVolume, &IDevice::getMasterVolume,
- {-0.1, 1.1, NAN, INFINITY, -INFINITY, 1 + std::numeric_limits<float>::epsilon()});
- // TODO: check that the master volume is really changed
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////////// AudioPatches ////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-class AudioPatchPrimaryHidlTest : public AudioPrimaryHidlTest {
- protected:
- bool areAudioPatchesSupported() {
- auto result = device->supportsAudioPatches();
- EXPECT_IS_OK(result);
- return result;
- }
-};
-
-TEST_F(AudioPatchPrimaryHidlTest, AudioPatches) {
- doc::test("Test if audio patches are supported");
- if (!areAudioPatchesSupported()) {
- doc::partialTest("Audio patches are not supported");
- return;
- }
- // TODO: test audio patches
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////// Required and recommended audio format support ///////////////
-// From:
-// https://source.android.com/compatibility/android-cdd.html#5_4_audio_recording
-// From:
-// https://source.android.com/compatibility/android-cdd.html#5_5_audio_playback
-/////////// TODO: move to the beginning of the file for easier update ////////
-//////////////////////////////////////////////////////////////////////////////
-
-class AudioConfigPrimaryTest : public AudioPatchPrimaryHidlTest {
- public:
- // Cache result ?
- static const vector<AudioConfig> getRequiredSupportPlaybackAudioConfig() {
- return combineAudioConfig({AudioChannelMask::OUT_STEREO, AudioChannelMask::OUT_MONO},
- {8000, 11025, 16000, 22050, 32000, 44100},
- {AudioFormat::PCM_16_BIT});
- }
-
- static const vector<AudioConfig> getRecommendedSupportPlaybackAudioConfig() {
- return combineAudioConfig({AudioChannelMask::OUT_STEREO, AudioChannelMask::OUT_MONO},
- {24000, 48000}, {AudioFormat::PCM_16_BIT});
- }
-
- static const vector<AudioConfig> getSupportedPlaybackAudioConfig() {
- // TODO: retrieve audio config supported by the platform
- // as declared in the policy configuration
- return {};
- }
-
- static const vector<AudioConfig> getRequiredSupportCaptureAudioConfig() {
- return combineAudioConfig({AudioChannelMask::IN_MONO}, {8000, 11025, 16000, 44100},
- {AudioFormat::PCM_16_BIT});
- }
- static const vector<AudioConfig> getRecommendedSupportCaptureAudioConfig() {
- return combineAudioConfig({AudioChannelMask::IN_STEREO}, {22050, 48000},
- {AudioFormat::PCM_16_BIT});
- }
- static const vector<AudioConfig> getSupportedCaptureAudioConfig() {
- // TODO: retrieve audio config supported by the platform
- // as declared in the policy configuration
- return {};
- }
-
- private:
- static const vector<AudioConfig> combineAudioConfig(vector<AudioChannelMask> channelMasks,
- vector<uint32_t> sampleRates,
- vector<AudioFormat> formats) {
- vector<AudioConfig> configs;
- for (auto channelMask : channelMasks) {
- for (auto sampleRate : sampleRates) {
- for (auto format : formats) {
- AudioConfig config{};
- // leave offloadInfo to 0
- config.channelMask = channelMask;
- config.sampleRateHz = sampleRate;
- config.format = format;
- // FIXME: leave frameCount to 0 ?
- configs.push_back(config);
- }
- }
- }
- return configs;
- }
-};
-
-/** Generate a test name based on an audio config.
- *
- * As the only parameter changing are channel mask and sample rate,
- * only print those ones in the test name.
- */
-static string generateTestName(const testing::TestParamInfo<AudioConfig>& info) {
- const AudioConfig& config = info.param;
- return to_string(info.index) + "__" + to_string(config.sampleRateHz) + "_" +
- // "MONO" is more clear than "FRONT_LEFT"
- ((config.channelMask == AudioChannelMask::OUT_MONO ||
- config.channelMask == AudioChannelMask::IN_MONO)
- ? "MONO"
- : toString(config.channelMask));
-}
-
-//////////////////////////////////////////////////////////////////////////////
-///////////////////////////// getInputBufferSize /////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-// FIXME: execute input test only if platform declares
-// android.hardware.microphone
-// how to get this value ? is it a property ???
-
-class AudioCaptureConfigPrimaryTest : public AudioConfigPrimaryTest,
- public ::testing::WithParamInterface<AudioConfig> {
- protected:
- void inputBufferSizeTest(const AudioConfig& audioConfig, bool supportRequired) {
- uint64_t bufferSize;
- ASSERT_OK(device->getInputBufferSize(audioConfig, returnIn(res, bufferSize)));
-
- switch (res) {
- case Result::INVALID_ARGUMENTS:
- EXPECT_FALSE(supportRequired);
- break;
- case Result::OK:
- // Check that the buffer is of a sane size
- // For now only that it is > 0
- EXPECT_GT(bufferSize, uint64_t(0));
- break;
- default:
- FAIL() << "Invalid return status: " << ::testing::PrintToString(res);
- }
- }
-};
-
-// Test that the required capture config and those declared in the policy are
-// indeed supported
-class RequiredInputBufferSizeTest : public AudioCaptureConfigPrimaryTest {};
-TEST_P(RequiredInputBufferSizeTest, RequiredInputBufferSizeTest) {
- doc::test(
- "Input buffer size must be retrievable for a format with required "
- "support.");
- inputBufferSizeTest(GetParam(), true);
-}
-INSTANTIATE_TEST_CASE_P(
- RequiredInputBufferSize, RequiredInputBufferSizeTest,
- ::testing::ValuesIn(AudioConfigPrimaryTest::getRequiredSupportCaptureAudioConfig()),
- &generateTestName);
-INSTANTIATE_TEST_CASE_P(
- SupportedInputBufferSize, RequiredInputBufferSizeTest,
- ::testing::ValuesIn(AudioConfigPrimaryTest::getSupportedCaptureAudioConfig()),
- &generateTestName);
-
-// Test that the recommended capture config are supported or lead to a
-// INVALID_ARGUMENTS return
-class OptionalInputBufferSizeTest : public AudioCaptureConfigPrimaryTest {};
-TEST_P(OptionalInputBufferSizeTest, OptionalInputBufferSizeTest) {
- doc::test(
- "Input buffer size should be retrievable for a format with recommended "
- "support.");
- inputBufferSizeTest(GetParam(), false);
-}
-INSTANTIATE_TEST_CASE_P(
- RecommendedCaptureAudioConfigSupport, OptionalInputBufferSizeTest,
- ::testing::ValuesIn(AudioConfigPrimaryTest::getRecommendedSupportCaptureAudioConfig()),
- &generateTestName);
-
-//////////////////////////////////////////////////////////////////////////////
-/////////////////////////////// setScreenState ///////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-TEST_F(AudioPrimaryHidlTest, setScreenState) {
- doc::test("Check that the hal can receive the screen state");
- for (bool turnedOn : {false, true, true, false, false}) {
- auto ret = device->setScreenState(turnedOn);
- ASSERT_IS_OK(ret);
- Result result = ret;
- auto okOrNotSupported = {Result::OK, Result::NOT_SUPPORTED};
- ASSERT_RESULT(okOrNotSupported, result);
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////// {get,set}Parameters /////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-TEST_F(AudioPrimaryHidlTest, getParameters) {
- doc::test("Check that the hal can set and get parameters");
- hidl_vec<hidl_string> keys;
- hidl_vec<ParameterValue> values;
- ASSERT_OK(device->getParameters(keys, returnIn(res, values)));
- ASSERT_OK(device->setParameters(values));
- values.resize(0);
- ASSERT_OK(device->setParameters(values));
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////////////////// debugDebug //////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-template <class DebugDump>
-static void testDebugDump(DebugDump debugDump) {
- // File descriptors to our pipe. fds[0] corresponds to the read end and
- // fds[1] to the write end.
- int fds[2];
- ASSERT_EQ(0, pipe2(fds, O_NONBLOCK)) << errno;
-
- // Make sure that the pipe is at least 1 MB in size. The test process runs
- // in su domain, so it should be safe to make this call.
- fcntl(fds[0], F_SETPIPE_SZ, 1 << 20);
-
- // Wrap the temporary file file descriptor in a native handle
- auto* nativeHandle = native_handle_create(1, 0);
- ASSERT_NE(nullptr, nativeHandle);
- nativeHandle->data[0] = fds[1];
-
- // Wrap this native handle in a hidl handle
- hidl_handle handle;
- handle.setTo(nativeHandle, false /*take ownership*/);
-
- ASSERT_OK(debugDump(handle));
-
- // Check that at least one bit was written by the hal
- // TODO: debugDump does not return a Result.
- // This mean that the hal can not report that it not implementing the
- // function.
- char buff;
- if (read(fds[0], &buff, 1) != 1) {
- doc::note("debugDump does not seem implemented");
- }
- EXPECT_EQ(0, close(fds[0])) << errno;
- EXPECT_EQ(0, close(fds[1])) << errno;
-}
-
-TEST_F(AudioPrimaryHidlTest, DebugDump) {
- doc::test("Check that the hal can dump its state without error");
- testDebugDump([](const auto& handle) { return device->debugDump(handle); });
-}
-
-TEST_F(AudioPrimaryHidlTest, DebugDumpInvalidArguments) {
- doc::test("Check that the hal dump doesn't crash on invalid arguments");
- ASSERT_OK(device->debugDump(hidl_handle()));
-}
-
-//////////////////////////////////////////////////////////////////////////////
-////////////////////////// open{Output,Input}Stream //////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-template <class Stream>
-class OpenStreamTest : public AudioConfigPrimaryTest,
- public ::testing::WithParamInterface<AudioConfig> {
- protected:
- template <class Open>
- void testOpen(Open openStream, const AudioConfig& config) {
- // FIXME: Open a stream without an IOHandle
- // This is not required to be accepted by hal implementations
- AudioIoHandle ioHandle = (AudioIoHandle)AudioHandleConsts::AUDIO_IO_HANDLE_NONE;
- AudioConfig suggestedConfig{};
- ASSERT_OK(openStream(ioHandle, config, returnIn(res, stream, suggestedConfig)));
-
- // TODO: only allow failure for RecommendedPlaybackAudioConfig
- switch (res) {
- case Result::OK:
- ASSERT_TRUE(stream != nullptr);
- audioConfig = config;
- break;
- case Result::INVALID_ARGUMENTS:
- ASSERT_TRUE(stream == nullptr);
- AudioConfig suggestedConfigRetry;
- // Could not open stream with config, try again with the
- // suggested one
- ASSERT_OK(openStream(ioHandle, suggestedConfig,
- returnIn(res, stream, suggestedConfigRetry)));
- // This time it must succeed
- ASSERT_OK(res);
- ASSERT_TRUE(stream != nullptr);
- audioConfig = suggestedConfig;
- break;
- default:
- FAIL() << "Invalid return status: " << ::testing::PrintToString(res);
- }
- open = true;
- }
-
- Return<Result> closeStream() {
- open = false;
- return stream->close();
- }
-
- private:
- void TearDown() override {
- if (open) {
- ASSERT_OK(stream->close());
- }
- }
-
- protected:
- AudioConfig audioConfig;
- DeviceAddress address = {};
- sp<Stream> stream;
- bool open = false;
-};
-
-////////////////////////////// openOutputStream //////////////////////////////
-
-class OutputStreamTest : public OpenStreamTest<IStreamOut> {
- virtual void SetUp() override {
- ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base
- address.device = AudioDevice::OUT_DEFAULT;
- const AudioConfig& config = GetParam();
- AudioOutputFlag flags = AudioOutputFlag::NONE; // TODO: test all flag combination
- testOpen(
- [&](AudioIoHandle handle, AudioConfig config, auto cb) {
- return device->openOutputStream(handle, address, config, flags, cb);
- },
- config);
- }
-};
-TEST_P(OutputStreamTest, OpenOutputStreamTest) {
- doc::test(
- "Check that output streams can be open with the required and "
- "recommended config");
- // Open done in SetUp
-}
-INSTANTIATE_TEST_CASE_P(
- RequiredOutputStreamConfigSupport, OutputStreamTest,
- ::testing::ValuesIn(AudioConfigPrimaryTest::getRequiredSupportPlaybackAudioConfig()),
- &generateTestName);
-INSTANTIATE_TEST_CASE_P(
- SupportedOutputStreamConfig, OutputStreamTest,
- ::testing::ValuesIn(AudioConfigPrimaryTest::getSupportedPlaybackAudioConfig()),
- &generateTestName);
-
-INSTANTIATE_TEST_CASE_P(
- RecommendedOutputStreamConfigSupport, OutputStreamTest,
- ::testing::ValuesIn(AudioConfigPrimaryTest::getRecommendedSupportPlaybackAudioConfig()),
- &generateTestName);
-
-////////////////////////////// openInputStream //////////////////////////////
-
-class InputStreamTest : public OpenStreamTest<IStreamIn> {
- virtual void SetUp() override {
- ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base
- address.device = AudioDevice::IN_DEFAULT;
- const AudioConfig& config = GetParam();
- AudioInputFlag flags = AudioInputFlag::NONE; // TODO: test all flag combination
- AudioSource source = AudioSource::DEFAULT; // TODO: test all flag combination
- testOpen(
- [&](AudioIoHandle handle, AudioConfig config, auto cb) {
- return device->openInputStream(handle, address, config, flags, source, cb);
- },
- config);
- }
-};
-
-TEST_P(InputStreamTest, OpenInputStreamTest) {
- doc::test(
- "Check that input streams can be open with the required and "
- "recommended config");
- // Open done in setup
-}
-INSTANTIATE_TEST_CASE_P(
- RequiredInputStreamConfigSupport, InputStreamTest,
- ::testing::ValuesIn(AudioConfigPrimaryTest::getRequiredSupportCaptureAudioConfig()),
- &generateTestName);
-INSTANTIATE_TEST_CASE_P(
- SupportedInputStreamConfig, InputStreamTest,
- ::testing::ValuesIn(AudioConfigPrimaryTest::getSupportedCaptureAudioConfig()),
- &generateTestName);
-
-INSTANTIATE_TEST_CASE_P(
- RecommendedInputStreamConfigSupport, InputStreamTest,
- ::testing::ValuesIn(AudioConfigPrimaryTest::getRecommendedSupportCaptureAudioConfig()),
- &generateTestName);
-
-//////////////////////////////////////////////////////////////////////////////
-////////////////////////////// IStream getters ///////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-/** Unpack the provided result.
- * If the result is not OK, register a failure and return an undefined value. */
-template <class R>
-static R extract(Return<R> ret) {
- if (!ret.isOk()) {
- EXPECT_IS_OK(ret);
- return R{};
- }
- return ret;
-}
-
-/* Could not find a way to write a test for two parametrized class fixure
- * thus use this macro do duplicate tests for Input and Output stream */
-#define TEST_IO_STREAM(test_name, documentation, code) \
- TEST_P(InputStreamTest, test_name) { \
- doc::test(documentation); \
- code; \
- } \
- TEST_P(OutputStreamTest, test_name) { \
- doc::test(documentation); \
- code; \
- }
-
-TEST_IO_STREAM(GetFrameCount, "Check that getting stream frame count does not crash the HAL.",
- ASSERT_TRUE(stream->getFrameCount().isOk()))
-
-TEST_IO_STREAM(GetSampleRate, "Check that the stream sample rate == the one it was opened with",
- ASSERT_EQ(audioConfig.sampleRateHz, extract(stream->getSampleRate())))
-
-TEST_IO_STREAM(GetChannelMask, "Check that the stream channel mask == the one it was opened with",
- ASSERT_EQ(audioConfig.channelMask, extract(stream->getChannelMask())))
-
-TEST_IO_STREAM(GetFormat, "Check that the stream format == the one it was opened with",
- ASSERT_EQ(audioConfig.format, extract(stream->getFormat())))
-
-// TODO: for now only check that the framesize is not incoherent
-TEST_IO_STREAM(GetFrameSize, "Check that the stream frame size == the one it was opened with",
- ASSERT_GT(extract(stream->getFrameSize()), 0U))
-
-TEST_IO_STREAM(GetBufferSize, "Check that the stream buffer size== the one it was opened with",
- ASSERT_GE(extract(stream->getBufferSize()), extract(stream->getFrameSize())));
-
-template <class Property, class CapabilityGetter>
-static void testCapabilityGetter(const string& name, IStream* stream,
- CapabilityGetter capablityGetter,
- Return<Property> (IStream::*getter)(),
- Return<Result> (IStream::*setter)(Property),
- bool currentMustBeSupported = true) {
- hidl_vec<Property> capabilities;
- ASSERT_OK((stream->*capablityGetter)(returnIn(capabilities)));
- if (capabilities.size() == 0) {
- // The default hal should probably return a NOT_SUPPORTED if the hal
- // does not expose
- // capability retrieval. For now it returns an empty list if not
- // implemented
- doc::partialTest(name + " is not supported");
- return;
- };
-
- if (currentMustBeSupported) {
- Property currentValue = extract((stream->*getter)());
- EXPECT_NE(std::find(capabilities.begin(), capabilities.end(), currentValue),
- capabilities.end())
- << "current " << name << " is not in the list of the supported ones "
- << toString(capabilities);
- }
-
- // Check that all declared supported values are indeed supported
- for (auto capability : capabilities) {
- auto ret = (stream->*setter)(capability);
- ASSERT_TRUE(ret.isOk());
- if (ret == Result::NOT_SUPPORTED) {
- doc::partialTest("Setter is not supported");
- return;
- }
- ASSERT_OK(ret);
- ASSERT_EQ(capability, extract((stream->*getter)()));
- }
-}
-
-TEST_IO_STREAM(SupportedSampleRate, "Check that the stream sample rate is declared as supported",
- testCapabilityGetter("getSupportedSampleRate", stream.get(),
- &IStream::getSupportedSampleRates, &IStream::getSampleRate,
- &IStream::setSampleRate,
- // getSupportedSampleRate returns the native sampling rates,
- // (the sampling rates that can be played without resampling)
- // but other sampling rates can be supported by the HAL.
- false))
-
-TEST_IO_STREAM(SupportedChannelMask, "Check that the stream channel mask is declared as supported",
- testCapabilityGetter("getSupportedChannelMask", stream.get(),
- &IStream::getSupportedChannelMasks, &IStream::getChannelMask,
- &IStream::setChannelMask))
-
-TEST_IO_STREAM(SupportedFormat, "Check that the stream format is declared as supported",
- testCapabilityGetter("getSupportedFormat", stream.get(),
- &IStream::getSupportedFormats, &IStream::getFormat,
- &IStream::setFormat))
-
-static void testGetDevice(IStream* stream, AudioDevice expectedDevice) {
- // Unfortunately the interface does not allow the implementation to return
- // NOT_SUPPORTED
- // Thus allow NONE as signaling that the call is not supported.
- auto ret = stream->getDevice();
- ASSERT_IS_OK(ret);
- AudioDevice device = ret;
- ASSERT_TRUE(device == expectedDevice || device == AudioDevice::NONE)
- << "Expected: " << ::testing::PrintToString(expectedDevice)
- << "\n Actual: " << ::testing::PrintToString(device);
-}
-
-TEST_IO_STREAM(GetDevice, "Check that the stream device == the one it was opened with",
- areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
- : testGetDevice(stream.get(), address.device))
-
-static void testSetDevice(IStream* stream, const DeviceAddress& address) {
- DeviceAddress otherAddress = address;
- otherAddress.device = (address.device & AudioDevice::BIT_IN) == 0 ? AudioDevice::OUT_SPEAKER
- : AudioDevice::IN_BUILTIN_MIC;
- EXPECT_OK(stream->setDevice(otherAddress));
-
- ASSERT_OK(stream->setDevice(address)); // Go back to the original value
-}
-
-TEST_IO_STREAM(SetDevice, "Check that the stream can be rerouted to SPEAKER or BUILTIN_MIC",
- areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
- : testSetDevice(stream.get(), address))
-
-static void testGetAudioProperties(IStream* stream, AudioConfig expectedConfig) {
- uint32_t sampleRateHz;
- AudioChannelMask mask;
- AudioFormat format;
-
- stream->getAudioProperties(returnIn(sampleRateHz, mask, format));
-
- // FIXME: the qcom hal it does not currently negotiate the sampleRate &
- // channel mask
- EXPECT_EQ(expectedConfig.sampleRateHz, sampleRateHz);
- EXPECT_EQ(expectedConfig.channelMask, mask);
- EXPECT_EQ(expectedConfig.format, format);
-}
-
-TEST_IO_STREAM(GetAudioProperties,
- "Check that the stream audio properties == the ones it was opened with",
- testGetAudioProperties(stream.get(), audioConfig))
-
-static void testConnectedState(IStream* stream) {
- DeviceAddress address = {};
- using AD = AudioDevice;
- for (auto device : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) {
- address.device = device;
-
- ASSERT_OK(stream->setConnectedState(address, true));
- ASSERT_OK(stream->setConnectedState(address, false));
- }
-}
-TEST_IO_STREAM(SetConnectedState,
- "Check that the stream can be notified of device connection and "
- "deconnection",
- testConnectedState(stream.get()))
-
-static auto invalidArgsOrNotSupportedOrOK = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED,
- Result::OK};
-TEST_IO_STREAM(SetHwAvSync, "Try to set hardware sync to an invalid value",
- ASSERT_RESULT(invalidArgsOrNotSupportedOrOK, stream->setHwAvSync(666)))
-
-TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail", ASSERT_IS_OK(device->getHwAvSync()));
-
-static void checkGetNoParameter(IStream* stream, hidl_vec<hidl_string> keys,
- initializer_list<Result> expectedResults) {
- hidl_vec<ParameterValue> parameters;
- Result res;
- ASSERT_OK(stream->getParameters(keys, returnIn(res, parameters)));
- ASSERT_RESULT(expectedResults, res);
- if (res == Result::OK) {
- for (auto& parameter : parameters) {
- ASSERT_EQ(0U, parameter.value.size()) << toString(parameter);
- }
- }
-}
-
-/* Get/Set parameter is intended to be an opaque channel between vendors app and
- * their HALs.
- * Thus can not be meaningfully tested.
- */
-TEST_IO_STREAM(getEmptySetParameter, "Retrieve the values of an empty set",
- checkGetNoParameter(stream.get(), {} /* keys */, {Result::OK}))
-
-TEST_IO_STREAM(getNonExistingParameter, "Retrieve the values of an non existing parameter",
- checkGetNoParameter(stream.get(), {"Non existing key"} /* keys */,
- {Result::NOT_SUPPORTED}))
-
-TEST_IO_STREAM(setEmptySetParameter, "Set the values of an empty set of parameters",
- ASSERT_RESULT(Result::OK, stream->setParameters({})))
-
-TEST_IO_STREAM(setNonExistingParameter, "Set the values of an non existing parameter",
- // Unfortunately, the set_parameter legacy interface did not return any
- // error code when a key is not supported.
- // To allow implementation to just wrapped the legacy one, consider OK as a
- // valid result for setting a non existing parameter.
- ASSERT_RESULT(invalidArgsOrNotSupportedOrOK,
- stream->setParameters({{"non existing key", "0"}})))
-
-TEST_IO_STREAM(DebugDump, "Check that a stream can dump its state without error",
- testDebugDump([this](const auto& handle) { return stream->debugDump(handle); }))
-
-TEST_IO_STREAM(DebugDumpInvalidArguments,
- "Check that the stream dump doesn't crash on invalid arguments",
- ASSERT_OK(stream->debugDump(hidl_handle())))
-
-//////////////////////////////////////////////////////////////////////////////
-////////////////////////////// addRemoveEffect ///////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-TEST_IO_STREAM(AddNonExistingEffect, "Adding a non existing effect should fail",
- ASSERT_RESULT(Result::INVALID_ARGUMENTS, stream->addEffect(666)))
-TEST_IO_STREAM(RemoveNonExistingEffect, "Removing a non existing effect should fail",
- ASSERT_RESULT(Result::INVALID_ARGUMENTS, stream->removeEffect(666)))
-
-// TODO: positive tests
-
-//////////////////////////////////////////////////////////////////////////////
-/////////////////////////////// Control ////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-TEST_IO_STREAM(standby, "Make sure the stream can be put in stanby",
- ASSERT_OK(stream->standby())) // can not fail
-
-static constexpr auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED};
-
-TEST_IO_STREAM(startNoMmap, "Starting a mmaped stream before mapping it should fail",
- ASSERT_RESULT(invalidStateOrNotSupported, stream->start()))
-
-TEST_IO_STREAM(stopNoMmap, "Stopping a mmaped stream before mapping it should fail",
- ASSERT_RESULT(invalidStateOrNotSupported, stream->stop()))
-
-TEST_IO_STREAM(getMmapPositionNoMmap, "Get a stream Mmap position before mapping it should fail",
- ASSERT_RESULT(invalidStateOrNotSupported, stream->stop()))
-
-TEST_IO_STREAM(close, "Make sure a stream can be closed", ASSERT_OK(closeStream()))
-TEST_IO_STREAM(closeTwice, "Make sure a stream can not be closed twice", ASSERT_OK(closeStream());
- ASSERT_RESULT(Result::INVALID_STATE, closeStream()))
-
-static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED};
-static void testCreateTooBigMmapBuffer(IStream* stream) {
- MmapBufferInfo info;
- Result res;
- // Assume that int max is a value too big to be allocated
- // This is true currently with a 32bit media server, but might not when it
- // will run in 64 bit
- auto minSizeFrames = std::numeric_limits<int32_t>::max();
- ASSERT_OK(stream->createMmapBuffer(minSizeFrames, returnIn(res, info)));
- ASSERT_RESULT(invalidArgsOrNotSupported, res);
-}
-
-TEST_IO_STREAM(CreateTooBigMmapBuffer, "Create mmap buffer too big should fail",
- testCreateTooBigMmapBuffer(stream.get()))
-
-static void testGetMmapPositionOfNonMmapedStream(IStream* stream) {
- Result res;
- MmapPosition position;
- ASSERT_OK(stream->getMmapPosition(returnIn(res, position)));
- ASSERT_RESULT(invalidArgsOrNotSupported, res);
-}
-
-TEST_IO_STREAM(GetMmapPositionOfNonMmapedStream,
- "Retrieving the mmap position of a non mmaped stream should fail",
- testGetMmapPositionOfNonMmapedStream(stream.get()))
-
-//////////////////////////////////////////////////////////////////////////////
-///////////////////////////////// StreamIn ///////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-TEST_P(InputStreamTest, GetAudioSource) {
- doc::test("Retrieving the audio source of an input stream should always succeed");
- AudioSource source;
- ASSERT_OK(stream->getAudioSource(returnIn(res, source)));
- if (res == Result::NOT_SUPPORTED) {
- doc::partialTest("getAudioSource is not supported");
- return;
- }
- ASSERT_OK(res);
- ASSERT_EQ(AudioSource::DEFAULT, source);
-}
-
-static void testUnitaryGain(std::function<Return<Result>(float)> setGain) {
- for (float value : (float[]){-INFINITY, -1.0, 1.0 + std::numeric_limits<float>::epsilon(), 2.0,
- INFINITY, NAN}) {
- EXPECT_RESULT(Result::INVALID_ARGUMENTS, setGain(value)) << "value=" << value;
- }
- // Do not consider -0.0 as an invalid value as it is == with 0.0
- for (float value : {-0.0, 0.0, 0.01, 0.5, 0.09, 1.0 /* Restore volume*/}) {
- EXPECT_OK(setGain(value)) << "value=" << value;
- }
-}
-
-static void testOptionalUnitaryGain(std::function<Return<Result>(float)> setGain,
- string debugName) {
- auto result = setGain(1);
- ASSERT_IS_OK(result);
- if (result == Result::NOT_SUPPORTED) {
- doc::partialTest(debugName + " is not supported");
- return;
- }
- testUnitaryGain(setGain);
-}
-
-TEST_P(InputStreamTest, SetGain) {
- doc::test("The gain of an input stream should only be set between [0,1]");
- testOptionalUnitaryGain([this](float volume) { return stream->setGain(volume); },
- "InputStream::setGain");
-}
-
-static void testPrepareForReading(IStreamIn* stream, uint32_t frameSize, uint32_t framesCount) {
- Result res;
- // Ignore output parameters as the call should fail
- ASSERT_OK(stream->prepareForReading(frameSize, framesCount,
- [&res](auto r, auto&, auto&, auto&, auto&) { res = r; }));
- EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
-}
-
-TEST_P(InputStreamTest, PrepareForReadingWithZeroBuffer) {
- doc::test("Preparing a stream for reading with a 0 sized buffer should fail");
- testPrepareForReading(stream.get(), 0, 0);
-}
-
-TEST_P(InputStreamTest, PrepareForReadingWithHugeBuffer) {
- doc::test("Preparing a stream for reading with a 2^32 sized buffer should fail");
- testPrepareForReading(stream.get(), 1, std::numeric_limits<uint32_t>::max());
-}
-
-TEST_P(InputStreamTest, PrepareForReadingCheckOverflow) {
- doc::test(
- "Preparing a stream for reading with a overflowing sized buffer should "
- "fail");
- auto uintMax = std::numeric_limits<uint32_t>::max();
- testPrepareForReading(stream.get(), uintMax, uintMax);
-}
-
-TEST_P(InputStreamTest, GetInputFramesLost) {
- doc::test("The number of frames lost on a never started stream should be 0");
- auto ret = stream->getInputFramesLost();
- ASSERT_IS_OK(ret);
- uint32_t framesLost{ret};
- ASSERT_EQ(0U, framesLost);
-}
-
-TEST_P(InputStreamTest, getCapturePosition) {
- doc::test(
- "The capture position of a non prepared stream should not be "
- "retrievable");
- uint64_t frames;
- uint64_t time;
- ASSERT_OK(stream->getCapturePosition(returnIn(res, frames, time)));
- ASSERT_RESULT(invalidStateOrNotSupported, res);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-///////////////////////////////// StreamIn ///////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-TEST_P(OutputStreamTest, getLatency) {
- doc::test("Make sure latency is over 0");
- auto result = stream->getLatency();
- ASSERT_IS_OK(result);
- ASSERT_GT(result, 0U);
-}
-
-TEST_P(OutputStreamTest, setVolume) {
- doc::test("Try to set the output volume");
- testOptionalUnitaryGain([this](float volume) { return stream->setVolume(volume, volume); },
- "setVolume");
-}
-
-static void testPrepareForWriting(IStreamOut* stream, uint32_t frameSize, uint32_t framesCount) {
- Result res;
- // Ignore output parameters as the call should fail
- ASSERT_OK(stream->prepareForWriting(frameSize, framesCount,
- [&res](auto r, auto&, auto&, auto&, auto&) { res = r; }));
- EXPECT_RESULT(Result::INVALID_ARGUMENTS, res);
-}
-
-TEST_P(OutputStreamTest, PrepareForWriteWithZeroBuffer) {
- doc::test("Preparing a stream for writing with a 0 sized buffer should fail");
- testPrepareForWriting(stream.get(), 0, 0);
-}
-
-TEST_P(OutputStreamTest, PrepareForWriteWithHugeBuffer) {
- doc::test("Preparing a stream for writing with a 2^32 sized buffer should fail");
- testPrepareForWriting(stream.get(), 1, std::numeric_limits<uint32_t>::max());
-}
-
-TEST_P(OutputStreamTest, PrepareForWritingCheckOverflow) {
- doc::test(
- "Preparing a stream for writing with a overflowing sized buffer should "
- "fail");
- auto uintMax = std::numeric_limits<uint32_t>::max();
- testPrepareForWriting(stream.get(), uintMax, uintMax);
-}
-
-struct Capability {
- Capability(IStreamOut* stream) {
- EXPECT_OK(stream->supportsPauseAndResume(returnIn(pause, resume)));
- auto ret = stream->supportsDrain();
- EXPECT_IS_OK(ret);
- if (ret.isOk()) {
- drain = ret;
- }
- }
- bool pause = false;
- bool resume = false;
- bool drain = false;
-};
-
-TEST_P(OutputStreamTest, SupportsPauseAndResumeAndDrain) {
- doc::test("Implementation must expose pause, resume and drain capabilities");
- Capability(stream.get());
-}
-
-template <class Value>
-static void checkInvalidStateOr0(Result res, Value value) {
- switch (res) {
- case Result::INVALID_STATE:
- break;
- case Result::OK:
- ASSERT_EQ(0U, value);
- break;
- default:
- FAIL() << "Unexpected result " << toString(res);
- }
-}
-
-TEST_P(OutputStreamTest, GetRenderPosition) {
- doc::test("A new stream render position should be 0 or INVALID_STATE");
- uint32_t dspFrames;
- ASSERT_OK(stream->getRenderPosition(returnIn(res, dspFrames)));
- if (res == Result::NOT_SUPPORTED) {
- doc::partialTest("getRenderPosition is not supported");
- return;
- }
- checkInvalidStateOr0(res, dspFrames);
-}
-
-TEST_P(OutputStreamTest, GetNextWriteTimestamp) {
- doc::test("A new stream next write timestamp should be 0 or INVALID_STATE");
- uint64_t timestampUs;
- ASSERT_OK(stream->getNextWriteTimestamp(returnIn(res, timestampUs)));
- if (res == Result::NOT_SUPPORTED) {
- doc::partialTest("getNextWriteTimestamp is not supported");
- return;
- }
- checkInvalidStateOr0(res, timestampUs);
-}
-
-/** Stub implementation of out stream callback. */
-class MockOutCallbacks : public IStreamOutCallback {
- Return<void> onWriteReady() override { return {}; }
- Return<void> onDrainReady() override { return {}; }
- Return<void> onError() override { return {}; }
-};
-
-static bool isAsyncModeSupported(IStreamOut* stream) {
- auto res = stream->setCallback(new MockOutCallbacks);
- stream->clearCallback(); // try to restore the no callback state, ignore
- // any error
- auto okOrNotSupported = {Result::OK, Result::NOT_SUPPORTED};
- EXPECT_RESULT(okOrNotSupported, res);
- return res.isOk() ? res == Result::OK : false;
-}
-
-TEST_P(OutputStreamTest, SetCallback) {
- doc::test(
- "If supported, registering callback for async operation should never "
- "fail");
- if (!isAsyncModeSupported(stream.get())) {
- doc::partialTest("The stream does not support async operations");
- return;
- }
- ASSERT_OK(stream->setCallback(new MockOutCallbacks));
- ASSERT_OK(stream->setCallback(new MockOutCallbacks));
-}
-
-TEST_P(OutputStreamTest, clearCallback) {
- doc::test(
- "If supported, clearing a callback to go back to sync operation should "
- "not fail");
- if (!isAsyncModeSupported(stream.get())) {
- doc::partialTest("The stream does not support async operations");
- return;
- }
- // TODO: Clarify if clearing a non existing callback should fail
- ASSERT_OK(stream->setCallback(new MockOutCallbacks));
- ASSERT_OK(stream->clearCallback());
-}
-
-TEST_P(OutputStreamTest, Resume) {
- doc::test(
- "If supported, a stream should fail to resume if not previously "
- "paused");
- if (!Capability(stream.get()).resume) {
- doc::partialTest("The output stream does not support resume");
- return;
- }
- ASSERT_RESULT(Result::INVALID_STATE, stream->resume());
-}
-
-TEST_P(OutputStreamTest, Pause) {
- doc::test(
- "If supported, a stream should fail to pause if not previously "
- "started");
- if (!Capability(stream.get()).pause) {
- doc::partialTest("The output stream does not support pause");
- return;
- }
- ASSERT_RESULT(Result::INVALID_STATE, stream->resume());
-}
-
-static void testDrain(IStreamOut* stream, AudioDrain type) {
- if (!Capability(stream).drain) {
- doc::partialTest("The output stream does not support drain");
- return;
- }
- ASSERT_RESULT(Result::OK, stream->drain(type));
-}
-
-TEST_P(OutputStreamTest, DrainAll) {
- doc::test("If supported, a stream should always succeed to drain");
- testDrain(stream.get(), AudioDrain::ALL);
-}
-
-TEST_P(OutputStreamTest, DrainEarlyNotify) {
- doc::test("If supported, a stream should always succeed to drain");
- testDrain(stream.get(), AudioDrain::EARLY_NOTIFY);
-}
-
-TEST_P(OutputStreamTest, FlushStop) {
- doc::test("If supported, a stream should always succeed to flush");
- auto ret = stream->flush();
- ASSERT_IS_OK(ret);
- if (ret == Result::NOT_SUPPORTED) {
- doc::partialTest("Flush is not supported");
- return;
- }
- ASSERT_OK(ret);
-}
-
-TEST_P(OutputStreamTest, GetPresentationPositionStop) {
- doc::test(
- "If supported, a stream should always succeed to retrieve the "
- "presentation position");
- uint64_t frames;
- TimeSpec mesureTS;
- ASSERT_OK(stream->getPresentationPosition(returnIn(res, frames, mesureTS)));
- if (res == Result::NOT_SUPPORTED) {
- doc::partialTest("getpresentationPosition is not supported");
- return;
- }
- ASSERT_EQ(0U, frames);
-
- if (mesureTS.tvNSec == 0 && mesureTS.tvSec == 0) {
- // As the stream has never written a frame yet,
- // the timestamp does not really have a meaning, allow to return 0
- return;
- }
-
- // Make sure the return measure is not more than 1s old.
- struct timespec currentTS;
- ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, ¤tTS)) << errno;
-
- auto toMicroSec = [](uint64_t sec, auto nsec) { return sec * 1e+6 + nsec / 1e+3; };
- auto currentTime = toMicroSec(currentTS.tv_sec, currentTS.tv_nsec);
- auto mesureTime = toMicroSec(mesureTS.tvSec, mesureTS.tvNSec);
- ASSERT_PRED2([](auto c, auto m) { return c - m < 1e+6; }, currentTime, mesureTime);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-/////////////////////////////// PrimaryDevice ////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-TEST_F(AudioPrimaryHidlTest, setVoiceVolume) {
- doc::test("Make sure setVoiceVolume only succeed if volume is in [0,1]");
- testUnitaryGain([](float volume) { return device->setVoiceVolume(volume); });
-}
-
-TEST_F(AudioPrimaryHidlTest, setMode) {
- doc::test(
- "Make sure setMode always succeeds if mode is valid "
- "and fails otherwise");
- // Test Invalid values
- for (AudioMode mode : {AudioMode::INVALID, AudioMode::CURRENT, AudioMode::CNT}) {
- SCOPED_TRACE("mode=" + toString(mode));
- ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(mode));
- }
- // Test valid values
- for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
- AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
- SCOPED_TRACE("mode=" + toString(mode));
- ASSERT_OK(device->setMode(mode));
- }
-}
-
-TEST_F(BoolAccessorPrimaryHidlTest, BtScoNrecEnabled) {
- doc::test("Query and set the BT SCO NR&EC state");
- testOptionalAccessors("BtScoNrecEnabled", {true, false, true},
- &IPrimaryDevice::setBtScoNrecEnabled,
- &IPrimaryDevice::getBtScoNrecEnabled);
-}
-
-TEST_F(BoolAccessorPrimaryHidlTest, setGetBtScoWidebandEnabled) {
- doc::test("Query and set the SCO whideband state");
- testOptionalAccessors("BtScoWideband", {true, false, true},
- &IPrimaryDevice::setBtScoWidebandEnabled,
- &IPrimaryDevice::getBtScoWidebandEnabled);
-}
-
-using TtyModeAccessorPrimaryHidlTest = AccessorPrimaryHidlTest<TtyMode>;
-TEST_F(TtyModeAccessorPrimaryHidlTest, setGetTtyMode) {
- doc::test("Query and set the TTY mode state");
- testOptionalAccessors("TTY mode", {TtyMode::OFF, TtyMode::HCO, TtyMode::VCO, TtyMode::FULL},
- &IPrimaryDevice::setTtyMode, &IPrimaryDevice::getTtyMode);
-}
-
-TEST_F(BoolAccessorPrimaryHidlTest, setGetHac) {
- doc::test("Query and set the HAC state");
- testOptionalAccessors("HAC", {true, false, true}, &IPrimaryDevice::setHacEnabled,
- &IPrimaryDevice::getHacEnabled);
-}
-
-//////////////////////////////////////////////////////////////////////////////
-//////////////////// Clean caches on global tear down ////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-int main(int argc, char** argv) {
- environment = new AudioHidlTestEnvironment;
- ::testing::AddGlobalTestEnvironment(environment);
- ::testing::InitGoogleTest(&argc, argv);
- environment->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- return status;
-}
diff --git a/audio/core/2.0/vts/functional/ValidateAudioConfiguration.cpp b/audio/core/2.0/vts/functional/ValidateAudioConfiguration.cpp
deleted file mode 100644
index bef0e82..0000000
--- a/audio/core/2.0/vts/functional/ValidateAudioConfiguration.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <unistd.h>
-#include <string>
-
-#include "utility/ValidateXml.h"
-
-TEST(CheckConfig, audioPolicyConfigurationValidation) {
- RecordProperty("description",
- "Verify that the audio policy configuration file "
- "is valid according to the schema");
-
- std::vector<const char*> locations = {"/odm/etc", "/vendor/etc", "/system/etc"};
- EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("audio_policy_configuration.xml", locations,
- "/data/local/tmp/audio_policy_configuration.xsd");
-}
diff --git a/audio/core/4.0/default/Android.bp b/audio/core/4.0/default/Android.bp
deleted file mode 100644
index 8e41545..0000000
--- a/audio/core/4.0/default/Android.bp
+++ /dev/null
@@ -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",
- ],
-
-}
diff --git a/audio/core/4.0/default/Conversions.cpp b/audio/core/4.0/default/Conversions.cpp
deleted file mode 100644
index 4f18744..0000000
--- a/audio/core/4.0/default/Conversions.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/Device.cpp b/audio/core/4.0/default/Device.cpp
deleted file mode 100644
index b33434e..0000000
--- a/audio/core/4.0/default/Device.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/DevicesFactory.cpp b/audio/core/4.0/default/DevicesFactory.cpp
deleted file mode 100644
index cb8a3c3..0000000
--- a/audio/core/4.0/default/DevicesFactory.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/OWNERS b/audio/core/4.0/default/OWNERS
deleted file mode 100644
index 6fdc97c..0000000
--- a/audio/core/4.0/default/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-elaurent@google.com
-krocard@google.com
-mnaganov@google.com
diff --git a/audio/core/4.0/default/ParametersUtil.cpp b/audio/core/4.0/default/ParametersUtil.cpp
deleted file mode 100644
index 2cc9fb5..0000000
--- a/audio/core/4.0/default/ParametersUtil.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "core/4.0/default/ParametersUtil.h"
-#include "core/4.0/default/Util.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <core/all-versions/default/ParametersUtil.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/core/4.0/default/PrimaryDevice.cpp b/audio/core/4.0/default/PrimaryDevice.cpp
deleted file mode 100644
index e3e4976..0000000
--- a/audio/core/4.0/default/PrimaryDevice.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/Stream.cpp b/audio/core/4.0/default/Stream.cpp
deleted file mode 100644
index b8c71de..0000000
--- a/audio/core/4.0/default/Stream.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/StreamIn.cpp b/audio/core/4.0/default/StreamIn.cpp
deleted file mode 100644
index 718bd25..0000000
--- a/audio/core/4.0/default/StreamIn.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "StreamInHAL"
-
-#include "core/4.0/default/StreamIn.h"
-#include "core/4.0/default/Util.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <core/all-versions/default/StreamIn.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/core/4.0/default/StreamOut.cpp b/audio/core/4.0/default/StreamOut.cpp
deleted file mode 100644
index db88e40..0000000
--- a/audio/core/4.0/default/StreamOut.cpp
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/include/core/4.0/default/Conversions.h b/audio/core/4.0/default/include/core/4.0/default/Conversions.h
deleted file mode 100644
index 32c2f88..0000000
--- a/audio/core/4.0/default/include/core/4.0/default/Conversions.h
+++ /dev/null
@@ -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_
diff --git a/audio/core/4.0/default/include/core/4.0/default/Device.h b/audio/core/4.0/default/include/core/4.0/default/Device.h
deleted file mode 100644
index 770d606..0000000
--- a/audio/core/4.0/default/include/core/4.0/default/Device.h
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/include/core/4.0/default/DevicesFactory.h b/audio/core/4.0/default/include/core/4.0/default/DevicesFactory.h
deleted file mode 100644
index 200e59d..0000000
--- a/audio/core/4.0/default/include/core/4.0/default/DevicesFactory.h
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/include/core/4.0/default/ParametersUtil.h b/audio/core/4.0/default/include/core/4.0/default/ParametersUtil.h
deleted file mode 100644
index fa31ee9..0000000
--- a/audio/core/4.0/default/include/core/4.0/default/ParametersUtil.h
+++ /dev/null
@@ -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_
diff --git a/audio/core/4.0/default/include/core/4.0/default/PrimaryDevice.h b/audio/core/4.0/default/include/core/4.0/default/PrimaryDevice.h
deleted file mode 100644
index e7f846b..0000000
--- a/audio/core/4.0/default/include/core/4.0/default/PrimaryDevice.h
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/include/core/4.0/default/Stream.h b/audio/core/4.0/default/include/core/4.0/default/Stream.h
deleted file mode 100644
index afad80f..0000000
--- a/audio/core/4.0/default/include/core/4.0/default/Stream.h
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/include/core/4.0/default/StreamIn.h b/audio/core/4.0/default/include/core/4.0/default/StreamIn.h
deleted file mode 100644
index 151f03f..0000000
--- a/audio/core/4.0/default/include/core/4.0/default/StreamIn.h
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/include/core/4.0/default/StreamOut.h b/audio/core/4.0/default/include/core/4.0/default/StreamOut.h
deleted file mode 100644
index dbf3bd1..0000000
--- a/audio/core/4.0/default/include/core/4.0/default/StreamOut.h
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/default/include/core/4.0/default/Util.h b/audio/core/4.0/default/include/core/4.0/default/Util.h
deleted file mode 100644
index ce31e6f..0000000
--- a/audio/core/4.0/default/include/core/4.0/default/Util.h
+++ /dev/null
@@ -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
diff --git a/audio/core/4.0/vts/OWNERS b/audio/core/4.0/vts/OWNERS
deleted file mode 100644
index 8711a9f..0000000
--- a/audio/core/4.0/vts/OWNERS
+++ /dev/null
@@ -1,5 +0,0 @@
-elaurent@google.com
-krocard@google.com
-mnaganov@google.com
-yim@google.com
-zhuoyao@google.com
\ No newline at end of file
diff --git a/audio/core/4.0/vts/functional/Android.bp b/audio/core/4.0/vts/functional/Android.bp
deleted file mode 100644
index e3b376c..0000000
--- a/audio/core/4.0/vts/functional/Android.bp
+++ /dev/null
@@ -1,38 +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: "VtsHalAudioV4_0TargetTest",
- defaults: ["VtsHalTargetTestDefaults"],
- srcs: [
- "AudioPrimaryHidlHalTest.cpp",
- "ValidateAudioConfiguration.cpp"
- ],
- static_libs: [
- "android.hardware.audio.common.test.utility",
- "android.hardware.audio@4.0",
- "android.hardware.audio.common@4.0",
- "libicuuc",
- "libicuuc_stubdata",
- "libxml2",
- ],
- shared_libs: [
- "libfmq",
- ],
- header_libs: [
- "android.hardware.audio.common.util@all-versions",
- ],
-}
diff --git a/audio/core/4.0/vts/functional/ValidateAudioConfiguration.cpp b/audio/core/4.0/vts/functional/ValidateAudioConfiguration.cpp
deleted file mode 100644
index a64513f..0000000
--- a/audio/core/4.0/vts/functional/ValidateAudioConfiguration.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <unistd.h>
-#include <string>
-
-#include "utility/ValidateXml.h"
-
-TEST(CheckConfig, audioPolicyConfigurationValidation) {
- RecordProperty("description",
- "Verify that the audio policy configuration file "
- "is valid according to the schema");
-
- std::vector<const char*> locations = {"/odm/etc", "/vendor/etc", "/system/etc"};
- EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("audio_policy_configuration.xml", locations,
- "/data/local/tmp/audio_policy_configuration_V4_0.xsd");
-}
diff --git a/audio/core/all-versions/default/Android.bp b/audio/core/all-versions/default/Android.bp
index bb02863..f8596d5 100644
--- a/audio/core/all-versions/default/Android.bp
+++ b/audio/core/all-versions/default/Android.bp
@@ -1,7 +1,18 @@
-cc_library_headers {
- name: "android.hardware.audio.core@all-versions-impl",
+cc_defaults {
+ name: "android.hardware.audio-impl_default",
relative_install_path: "hw",
+ proprietary: true,
vendor: true,
+ srcs: [
+ "Conversions.cpp",
+ "Device.cpp",
+ "DevicesFactory.cpp",
+ "ParametersUtil.cpp",
+ "PrimaryDevice.cpp",
+ "Stream.cpp",
+ "StreamIn.cpp",
+ "StreamOut.cpp",
+ ],
defaults: ["hidl_defaults"],
@@ -20,10 +31,48 @@
],
header_libs: [
+ "android.hardware.audio.common.util@all-versions",
"libaudioclient_headers",
"libaudio_system_headers",
"libhardware_headers",
"libmedia_headers",
- "android.hardware.audio.common.util@all-versions",
],
+
+ whole_static_libs: [
+ "libmedia_helper",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.audio@2.0-impl",
+ defaults: ["android.hardware.audio-impl_default"],
+
+ shared_libs: [
+ "android.hardware.audio@2.0",
+ "android.hardware.audio.common@2.0",
+ "android.hardware.audio.common@2.0-util",
+ ],
+
+ cflags: [
+ "-DMAJOR_VERSION=2",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
+}
+
+cc_library_shared {
+ name: "android.hardware.audio@4.0-impl",
+ defaults: ["android.hardware.audio-impl_default"],
+
+ shared_libs: [
+ "android.hardware.audio@4.0",
+ "android.hardware.audio.common@4.0",
+ "android.hardware.audio.common@4.0-util",
+ ],
+
+ cflags: [
+ "-DMAJOR_VERSION=4",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
}
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Conversions.impl.h b/audio/core/all-versions/default/Conversions.cpp
similarity index 96%
rename from audio/core/all-versions/default/include/core/all-versions/default/Conversions.impl.h
rename to audio/core/all-versions/default/Conversions.cpp
index 5828c3f..7ce0c59 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Conversions.impl.h
+++ b/audio/core/all-versions/default/Conversions.cpp
@@ -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 @@
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 @@
#endif
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h b/audio/core/all-versions/default/Device.cpp
similarity index 94%
rename from audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h
rename to audio/core/all-versions/default/Device.cpp
index 52d2186..b2bd405 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Device.impl.h
+++ b/audio/core/all-versions/default/Device.cpp
@@ -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 @@
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::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();
}
-#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::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 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<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 @@
}
#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();
}
-#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 @@
#endif
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.impl.h b/audio/core/all-versions/default/DevicesFactory.cpp
similarity index 91%
rename from audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.impl.h
rename to audio/core/all-versions/default/DevicesFactory.cpp
index a9f59fb..67fc5d3 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.impl.h
+++ b/audio/core/all-versions/default/DevicesFactory.cpp
@@ -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 @@
_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 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/core/all-versions/OWNERS b/audio/core/all-versions/default/OWNERS
similarity index 100%
rename from audio/core/all-versions/OWNERS
rename to audio/core/all-versions/default/OWNERS
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h b/audio/core/all-versions/default/ParametersUtil.cpp
similarity index 95%
rename from audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h
rename to audio/core/all-versions/default/ParametersUtil.cpp
index 34bc53c..0c8e28a 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.impl.h
+++ b/audio/core/all-versions/default/ParametersUtil.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,14 +14,16 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
-#include <core/all-versions/default/Conversions.h>
+#include "core/default/ParametersUtil.h"
+#include "core/default/Conversions.h"
+#include "core/default/Util.h"
+
#include <system/audio.h>
namespace android {
namespace hardware {
namespace audio {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
/** Converts a status_t in Result according to the rules of AudioParameter::get*
@@ -159,7 +161,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.impl.h b/audio/core/all-versions/default/PrimaryDevice.cpp
similarity index 94%
rename from audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.impl.h
rename to audio/core/all-versions/default/PrimaryDevice.cpp
index f269dd4..ff0fecc 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.impl.h
+++ b/audio/core/all-versions/default/PrimaryDevice.cpp
@@ -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 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 @@
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 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<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 @@
}
#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 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 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h b/audio/core/all-versions/default/Stream.cpp
similarity index 94%
rename from audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h
rename to audio/core/all-versions/default/Stream.cpp
index 72d7a37..f9a202b 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Stream.impl.h
+++ b/audio/core/all-versions/default/Stream.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "StreamHAL"
+
+#include "core/default/Stream.h"
+#include "common/all-versions/default/EffectMap.h"
+#include "core/default/Conversions.h"
+#include "core/default/Util.h"
#include <inttypes.h>
@@ -28,7 +33,7 @@
namespace android {
namespace hardware {
namespace audio {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
Stream::Stream(audio_stream_t* stream) : mStream(stream) {}
@@ -42,7 +47,6 @@
return util::analyzeStatus("stream", funcName, status);
}
-
// static
Result Stream::analyzeStatus(const char* funcName, int status,
const std::vector<int>& ignoreErrors) {
@@ -57,7 +61,7 @@
return mStream->set_parameters(mStream, keysAndValues);
}
-// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
+// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
Return<uint64_t> Stream::getFrameSize() {
// Needs to be implemented by interface subclasses. But can't be declared as pure virtual,
// since interface subclasses implementation do not inherit from this class.
@@ -79,7 +83,7 @@
return mStream->get_sample_rate(mStream);
}
-#ifdef AUDIO_HAL_VERSION_2_0
+#if MAJOR_VERSION == 2
Return<void> Stream::getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) {
return getSupportedSampleRates(getFormat(), _hidl_cb);
}
@@ -107,9 +111,9 @@
result = Result::NOT_SUPPORTED;
}
}
-#ifdef AUDIO_HAL_VERSION_2_0
+#if MAJOR_VERSION == 2
_hidl_cb(sampleRates);
-#elif AUDIO_HAL_VERSION_4_0
+#elif MAJOR_VERSION == 4
_hidl_cb(result, sampleRates);
#endif
return Void();
@@ -136,9 +140,9 @@
result = Result::NOT_SUPPORTED;
}
}
-#ifdef AUDIO_HAL_VERSION_2_0
+#if MAJOR_VERSION == 2
_hidl_cb(channelMasks);
-#elif defined(AUDIO_HAL_VERSION_4_0)
+#elif MAJOR_VERSION == 4
_hidl_cb(result, channelMasks);
#endif
return Void();
@@ -217,7 +221,7 @@
return setParam(AudioParameter::keyStreamHwAvSync, static_cast<int>(hwAvSync));
}
-#ifdef AUDIO_HAL_VERSION_2_0
+#if MAJOR_VERSION == 2
Return<AudioDevice> Stream::getDevice() {
int device = 0;
Result retval = getParam(AudioParameter::keyRouting, &device);
@@ -242,7 +246,7 @@
connected ? AudioParameter::keyStreamConnect : AudioParameter::keyStreamDisconnect,
address);
}
-#elif defined(AUDIO_HAL_VERSION_4_0)
+#elif MAJOR_VERSION == 4
Return<void> Stream::getDevices(getDevices_cb _hidl_cb) {
int device = 0;
Result retval = getParam(AudioParameter::keyRouting, &device);
@@ -314,14 +318,14 @@
return Void();
}
-#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
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h b/audio/core/all-versions/default/StreamIn.cpp
similarity index 95%
rename from audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h
rename to audio/core/all-versions/default/StreamIn.cpp
index 64c85ab..d19526a 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.impl.h
+++ b/audio/core/all-versions/default/StreamIn.cpp
@@ -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,17 +28,15 @@
#include <utils/Trace.h>
#include <memory>
-using ::android::hardware::audio::AUDIO_HAL_VERSION::MessageQueueFlagBits;
-#include "Conversions.h"
+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 {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo;
-
namespace {
class ReadThread : public Thread {
@@ -162,7 +164,7 @@
mStream = nullptr;
}
-// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow.
+// Methods from ::android::hardware::audio::CPP_VERSION::IStream follow.
Return<uint64_t> StreamIn::getFrameSize() {
return audio_stream_in_frame_size(mStream);
}
@@ -179,7 +181,7 @@
return mStreamCommon->getSampleRate();
}
-#ifdef AUDIO_HAL_VERSION_2_0
+#if MAJOR_VERSION == 2
Return<void> StreamIn::getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) {
return mStreamCommon->getSupportedChannelMasks(_hidl_cb);
}
@@ -241,7 +243,7 @@
return mStreamCommon->setHwAvSync(hwAvSync);
}
-#ifdef AUDIO_HAL_VERSION_2_0
+#if MAJOR_VERSION == 2
Return<Result> StreamIn::setConnectedState(const DeviceAddress& address, bool connected) {
return mStreamCommon->setConnectedState(address, connected);
}
@@ -265,7 +267,7 @@
Return<void> StreamIn::debugDump(const hidl_handle& fd) {
return mStreamCommon->debugDump(fd);
}
-#elif defined(AUDIO_HAL_VERSION_4_0)
+#elif MAJOR_VERSION == 4
Return<void> StreamIn::getDevices(getDevices_cb _hidl_cb) {
return mStreamCommon->getDevices(_hidl_cb);
}
@@ -313,7 +315,7 @@
return Result::OK;
}
-// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow.
+// Methods from ::android::hardware::audio::CPP_VERSION::IStreamIn follow.
Return<void> StreamIn::getAudioSource(getAudioSource_cb _hidl_cb) {
int halSource;
Result retval = mStreamCommon->getParam(AudioParameter::keyInputSource, &halSource);
@@ -342,7 +344,6 @@
auto sendError = [&threadInfo, &_hidl_cb](Result result) {
_hidl_cb(result, CommandMQ::Descriptor(), DataMQ::Descriptor(), StatusMQ::Descriptor(),
threadInfo);
-
};
// Create message queues.
@@ -448,7 +449,7 @@
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
@@ -460,7 +461,8 @@
{.source = static_cast<audio_source_t>(metadata.source), .gain = metadata.gain});
}
const sink_metadata_t halMetadata = {
- .track_count = halTracks.size(), .tracks = halTracks.data(),
+ .track_count = halTracks.size(),
+ .tracks = halTracks.data(),
};
mStream->update_sink_metadata(mStream, &halMetadata);
return Void();
@@ -487,7 +489,7 @@
#endif
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/StreamOut.impl.h b/audio/core/all-versions/default/StreamOut.cpp
similarity index 96%
rename from audio/core/all-versions/default/include/core/all-versions/default/StreamOut.impl.h
rename to audio/core/all-versions/default/StreamOut.cpp
index 6fb157f..4ae0fb1 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/StreamOut.impl.h
+++ b/audio/core/all-versions/default/StreamOut.cpp
@@ -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 @@
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 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 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<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::OK;
}
-// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow.
+// Methods from ::android::hardware::audio::CPP_VERSION::IStreamOut follow.
Return<uint32_t> StreamOut::getLatency() {
return mStream->get_latency(mStream);
}
@@ -326,7 +329,6 @@
auto sendError = [&threadInfo, &_hidl_cb](Result result) {
_hidl_cb(result, CommandMQ::Descriptor(), DataMQ::Descriptor(), StatusMQ::Descriptor(),
threadInfo);
-
};
// Create message queues.
@@ -545,7 +547,7 @@
return mStreamCommon->debug(fd, options);
}
-#ifdef AUDIO_HAL_VERSION_4_0
+#if MAJOR_VERSION == 4
Return<void> StreamOut::updateSourceMetadata(const SourceMetadata& sourceMetadata) {
if (mStream->update_source_metadata == nullptr) {
return Void(); // not supported by the HAL
@@ -560,7 +562,8 @@
});
}
const source_metadata_t halMetadata = {
- .track_count = halTracks.size(), .tracks = halTracks.data(),
+ .track_count = halTracks.size(),
+ .tracks = halTracks.data(),
};
mStream->update_source_metadata(mStream, &halMetadata);
return Void();
@@ -571,7 +574,7 @@
#endif
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Conversions.h b/audio/core/all-versions/default/include/core/default/Conversions.h
similarity index 72%
rename from audio/core/all-versions/default/include/core/all-versions/default/Conversions.h
rename to audio/core/all-versions/default/include/core/default/Conversions.h
index b38eca3..f843450 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Conversions.h
+++ b/audio/core/all-versions/default/include/core/default/Conversions.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,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_
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Device.h b/audio/core/all-versions/default/include/core/default/Device.h
similarity index 74%
rename from audio/core/all-versions/default/include/core/all-versions/default/Device.h
rename to audio/core/all-versions/default/include/core/default/Device.h
index 222d3de..b92b90a 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Device.h
+++ b/audio/core/all-versions/default/include/core/default/Device.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_DEVICE_H
+#define ANDROID_HARDWARE_AUDIO_DEVICE_H
+
+#include PATH(android/hardware/audio/FILE_VERSION/IDevice.h)
+
+#include "ParametersUtil.h"
#include <memory>
@@ -30,41 +35,40 @@
namespace android {
namespace hardware {
namespace audio {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioHwSync;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPatchHandle;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioInputFlagBitfield;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::
- AudioOutputFlagBitfield;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+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::SourceMetadata;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::SinkMetadata;
+#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 @@
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 @@
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 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_DEVICE_H
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.h b/audio/core/all-versions/default/include/core/default/DevicesFactory.h
similarity index 75%
rename from audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.h
rename to audio/core/all-versions/default/include/core/default/DevicesFactory.h
index 1509ad1..00c983d 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/DevicesFactory.h
+++ b/audio/core/all-versions/default/include/core/default/DevicesFactory.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,10 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_DEVICESFACTORY_H
+#define ANDROID_HARDWARE_AUDIO_DEVICESFACTORY_H
+
+#include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h)
#include <hardware/audio.h>
@@ -24,23 +27,22 @@
namespace android {
namespace hardware {
namespace audio {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::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 @@
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
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.h b/audio/core/all-versions/default/include/core/default/ParametersUtil.h
similarity index 80%
rename from audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.h
rename to audio/core/all-versions/default/include/core/default/ParametersUtil.h
index 35ff110..ba4ca0c 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/ParametersUtil.h
+++ b/audio/core/all-versions/default/include/core/default/ParametersUtil.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,10 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_
+#define ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_
+
+#include PATH(android/hardware/audio/FILE_VERSION/types.h)
#include <functional>
#include <memory>
@@ -25,14 +28,14 @@
namespace android {
namespace hardware {
namespace audio {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
+using ::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 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_PARAMETERS_UTIL_H_
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.h b/audio/core/all-versions/default/include/core/default/PrimaryDevice.h
similarity index 77%
rename from audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.h
rename to audio/core/all-versions/default/include/core/default/PrimaryDevice.h
index 42996d7..e5aa05b 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/PrimaryDevice.h
+++ b/audio/core/all-versions/default/include/core/default/PrimaryDevice.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H
+#define ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H
+
+#include PATH(android/hardware/audio/FILE_VERSION/IPrimaryDevice.h)
+
+#include "Device.h"
#include <hidl/Status.h>
@@ -23,33 +28,33 @@
namespace android {
namespace hardware {
namespace audio {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_PRIMARYDEVICE_H
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Stream.h b/audio/core/all-versions/default/include/core/default/Stream.h
similarity index 88%
rename from audio/core/all-versions/default/include/core/all-versions/default/Stream.h
rename to audio/core/all-versions/default/include/core/default/Stream.h
index 7cf12dd..87afa7c 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Stream.h
+++ b/audio/core/all-versions/default/include/core/default/Stream.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_STREAM_H
+#define ANDROID_HARDWARE_AUDIO_STREAM_H
+
+#include PATH(android/hardware/audio/FILE_VERSION/IStream.h)
+
+#include "ParametersUtil.h"
#include <vector>
@@ -28,22 +33,22 @@
namespace android {
namespace hardware {
namespace audio {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::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 @@
*/
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 @@
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 @@
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 @@
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 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_STREAM_H
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.h b/audio/core/all-versions/default/include/core/default/StreamIn.h
similarity index 81%
rename from audio/core/all-versions/default/include/core/all-versions/default/StreamIn.h
rename to audio/core/all-versions/default/include/core/default/StreamIn.h
index f226e63..52d97eb 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/StreamIn.h
+++ b/audio/core/all-versions/default/include/core/default/StreamIn.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,13 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_STREAMIN_H
+#define ANDROID_HARDWARE_AUDIO_STREAMIN_H
+
+#include PATH(android/hardware/audio/FILE_VERSION/IStreamIn.h)
+
+#include "Device.h"
+#include "Stream.h"
#include <atomic>
#include <memory>
@@ -28,23 +34,23 @@
namespace android {
namespace hardware {
namespace audio {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::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 @@
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 @@
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 @@
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 @@
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 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_STREAMIN_H
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/StreamOut.h b/audio/core/all-versions/default/include/core/default/StreamOut.h
similarity index 81%
rename from audio/core/all-versions/default/include/core/all-versions/default/StreamOut.h
rename to audio/core/all-versions/default/include/core/default/StreamOut.h
index 134d7b9..399766e 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/StreamOut.h
+++ b/audio/core/all-versions/default/include/core/default/StreamOut.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,13 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_STREAMOUT_H
+#define ANDROID_HARDWARE_AUDIO_STREAMOUT_H
+
+#include PATH(android/hardware/audio/FILE_VERSION/IStreamOut.h)
+
+#include "Device.h"
+#include "Stream.h"
#include <atomic>
#include <memory>
@@ -28,25 +34,25 @@
namespace android {
namespace hardware {
namespace audio {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::AudioDrain;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOutCallback;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::Result;
-using ::android::hardware::audio::AUDIO_HAL_VERSION::TimeSpec;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::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 @@
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 @@
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 @@
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 @@
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 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_STREAMOUT_H
diff --git a/audio/core/all-versions/default/include/core/all-versions/default/Util.h b/audio/core/all-versions/default/include/core/default/Util.h
similarity index 85%
rename from audio/core/all-versions/default/include/core/all-versions/default/Util.h
rename to audio/core/all-versions/default/include/core/default/Util.h
index 350fd86..2b8c3fd 100644
--- a/audio/core/all-versions/default/include/core/all-versions/default/Util.h
+++ b/audio/core/all-versions/default/include/core/default/Util.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,10 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_UTIL_H
+#define ANDROID_HARDWARE_AUDIO_UTIL_H
+
+#include PATH(android/hardware/audio/FILE_VERSION/types.h)
#include <algorithm>
#include <vector>
@@ -24,10 +27,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 @@
} // namespace util
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_UTIL_H
diff --git a/audio/core/2.0/vts/OWNERS b/audio/core/all-versions/vts/OWNERS
similarity index 98%
rename from audio/core/2.0/vts/OWNERS
rename to audio/core/all-versions/vts/OWNERS
index 8711a9f..0ea4666 100644
--- a/audio/core/2.0/vts/OWNERS
+++ b/audio/core/all-versions/vts/OWNERS
@@ -2,4 +2,4 @@
krocard@google.com
mnaganov@google.com
yim@google.com
-zhuoyao@google.com
\ No newline at end of file
+zhuoyao@google.com
diff --git a/audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalTest.cpp
new file mode 100644
index 0000000..7906bf1
--- /dev/null
+++ b/audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalTest.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "AudioPrimaryHidlHalTest.h"
+
+static void testGetDevice(IStream* stream, AudioDevice expectedDevice) {
+ // Unfortunately the interface does not allow the implementation to return
+ // NOT_SUPPORTED
+ // Thus allow NONE as signaling that the call is not supported.
+ auto ret = stream->getDevice();
+ ASSERT_IS_OK(ret);
+ AudioDevice device = ret;
+ ASSERT_TRUE(device == expectedDevice || device == AudioDevice::NONE)
+ << "Expected: " << ::testing::PrintToString(expectedDevice)
+ << "\n Actual: " << ::testing::PrintToString(device);
+}
+
+TEST_IO_STREAM(GetDevice, "Check that the stream device == the one it was opened with",
+ areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
+ : testGetDevice(stream.get(), address.device))
+
+static void testSetDevice(IStream* stream, const DeviceAddress& address) {
+ DeviceAddress otherAddress = address;
+ otherAddress.device = (address.device & AudioDevice::BIT_IN) == 0 ? AudioDevice::OUT_SPEAKER
+ : AudioDevice::IN_BUILTIN_MIC;
+ EXPECT_OK(stream->setDevice(otherAddress));
+
+ ASSERT_OK(stream->setDevice(address)); // Go back to the original value
+}
+
+TEST_IO_STREAM(SetDevice, "Check that the stream can be rerouted to SPEAKER or BUILTIN_MIC",
+ areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
+ : testSetDevice(stream.get(), address))
+
+static void testConnectedState(IStream* stream) {
+ DeviceAddress address = {};
+ using AD = AudioDevice;
+ for (auto device : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) {
+ address.device = device;
+
+ ASSERT_OK(stream->setConnectedState(address, true));
+ ASSERT_OK(stream->setConnectedState(address, false));
+ }
+}
+TEST_IO_STREAM(SetConnectedState,
+ "Check that the stream can be notified of device connection and "
+ "deconnection",
+ testConnectedState(stream.get()))
+
+TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail", ASSERT_IS_OK(device->getHwAvSync()));
+
+TEST_F(AudioPrimaryHidlTest, setMode) {
+ doc::test("Make sure setMode always succeeds if mode is valid and fails otherwise");
+ // Test Invalid values
+ for (AudioMode mode : {AudioMode::INVALID, AudioMode::CURRENT, AudioMode::CNT}) {
+ SCOPED_TRACE("mode=" + toString(mode));
+ ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(mode));
+ }
+ // Test valid values
+ for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
+ AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
+ SCOPED_TRACE("mode=" + toString(mode));
+ ASSERT_OK(device->setMode(mode));
+ }
+}
diff --git a/audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalUtils.h b/audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalUtils.h
new file mode 100644
index 0000000..1cffd41
--- /dev/null
+++ b/audio/core/all-versions/vts/functional/2.0/AudioPrimaryHidlHalUtils.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include PATH(android/hardware/audio/FILE_VERSION/IStream.h)
+#include PATH(android/hardware/audio/FILE_VERSION/types.h)
+#include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
+#include <hidl/HidlSupport.h>
+
+using ::android::hardware::hidl_handle;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
+using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
+using ::android::hardware::audio::CPP_VERSION::IStream;
+using ::android::hardware::audio::CPP_VERSION::ParameterValue;
+using ::android::hardware::audio::CPP_VERSION::Result;
+
+using namespace ::android::hardware::audio::common::test::utility;
+
+struct Parameters {
+ template <class T, class ReturnIn>
+ static auto get(T t, hidl_vec<hidl_string> keys, ReturnIn returnIn) {
+ return t->getParameters(keys, returnIn);
+ }
+ template <class T>
+ static auto set(T t, hidl_vec<ParameterValue> values) {
+ return t->setParameters(values);
+ }
+};
+
+// The default hal should probably return a NOT_SUPPORTED if the hal
+// does not expose
+// capability retrieval. For now it returns an empty list if not
+// implemented
+struct GetSupported {
+ template <class Vec>
+ static Result convertToResult(const Vec& vec) {
+ return vec.size() == 0 ? Result::NOT_SUPPORTED : Result::OK;
+ }
+
+ static Result sampleRates(IStream* stream, hidl_vec<uint32_t>& rates) {
+ EXPECT_OK(stream->getSupportedSampleRates(returnIn(rates)));
+ return convertToResult(rates);
+ }
+
+ static Result channelMasks(IStream* stream, hidl_vec<AudioChannelMask>& channels) {
+ EXPECT_OK(stream->getSupportedChannelMasks(returnIn(channels)));
+ return convertToResult(channels);
+ }
+
+ static Result formats(IStream* stream, hidl_vec<AudioFormat>& capabilities) {
+ EXPECT_OK(stream->getSupportedFormats(returnIn(capabilities)));
+ // TODO: this should be an optional function
+ return Result::OK;
+ }
+};
+
+template <class T>
+auto dump(T t, hidl_handle handle) {
+ return t->debugDump(handle);
+}
diff --git a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
new file mode 100644
index 0000000..e7c1e58
--- /dev/null
+++ b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "AudioPrimaryHidlHalTest.h"
+
+static void waitForDeviceDestruction() {
+ // FIXME: there is no way to know when the remote IDevice is being destroyed
+ // Binder does not support testing if an object is alive, thus
+ // wait for 100ms to let the binder destruction propagates and
+ // the remote device has the time to be destroyed.
+ // flushCommand makes sure all local command are sent, thus should reduce
+ // the latency between local and remote destruction.
+ IPCThreadState::self()->flushCommands();
+ usleep(100);
+}
+
+TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) {
+ doc::test("Calling openDevice(\"primary\") should return the primary device.");
+ {
+ Result result;
+ sp<IDevice> baseDevice;
+ ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice)));
+ ASSERT_OK(result);
+ ASSERT_TRUE(baseDevice != nullptr);
+
+ Return<sp<IPrimaryDevice>> primaryDevice = IPrimaryDevice::castFrom(baseDevice);
+ ASSERT_TRUE(primaryDevice.isOk());
+ ASSERT_TRUE(sp<IPrimaryDevice>(primaryDevice) != nullptr);
+ } // Destroy local IDevice proxy
+ waitForDeviceDestruction();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/////////////////////////// get(Active)Microphones ///////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TEST_F(AudioPrimaryHidlTest, GetMicrophonesTest) {
+ doc::test("Make sure getMicrophones always succeeds");
+ hidl_vec<MicrophoneInfo> microphones;
+ ASSERT_OK(device->getMicrophones(returnIn(res, microphones)));
+ ASSERT_OK(res);
+ if (microphones.size() > 0) {
+ // When there is microphone on the phone, try to open an input stream
+ // and query for the active microphones.
+ doc::test(
+ "Make sure getMicrophones always succeeds"
+ "and getActiveMicrophones always succeeds when recording from these microphones.");
+ AudioIoHandle ioHandle = (AudioIoHandle)AudioHandleConsts::AUDIO_IO_HANDLE_NONE;
+ AudioConfig config{};
+ config.channelMask = mkEnumBitfield(AudioChannelMask::IN_MONO);
+ config.sampleRateHz = 8000;
+ config.format = AudioFormat::PCM_16_BIT;
+ auto flags = hidl_bitfield<AudioInputFlag>(AudioInputFlag::NONE);
+ const SinkMetadata initMetadata = {{{AudioSource::MIC, 1 /* gain */}}};
+ EventFlag* efGroup;
+ for (auto microphone : microphones) {
+ if (microphone.deviceAddress.device != AudioDevice::IN_BUILTIN_MIC) {
+ continue;
+ }
+ sp<IStreamIn> stream;
+ AudioConfig suggestedConfig{};
+ ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress, config, flags,
+ initMetadata,
+ returnIn(res, stream, suggestedConfig)));
+ if (res != Result::OK) {
+ ASSERT_TRUE(stream == nullptr);
+ AudioConfig suggestedConfigRetry{};
+ ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress,
+ suggestedConfig, flags, initMetadata,
+ returnIn(res, stream, suggestedConfigRetry)));
+ }
+ ASSERT_OK(res);
+ hidl_vec<MicrophoneInfo> activeMicrophones;
+ Result readRes;
+ typedef MessageQueue<ReadParameters, kSynchronizedReadWrite> CommandMQ;
+ typedef MessageQueue<uint8_t, kSynchronizedReadWrite> DataMQ;
+ std::unique_ptr<CommandMQ> commandMQ;
+ std::unique_ptr<DataMQ> dataMQ;
+ size_t frameSize = stream->getFrameSize();
+ size_t frameCount = stream->getBufferSize() / frameSize;
+ ASSERT_OK(stream->prepareForReading(
+ frameSize, frameCount, [&](auto r, auto& c, auto& d, auto&, auto&) {
+ readRes = r;
+ if (readRes == Result::OK) {
+ commandMQ.reset(new CommandMQ(c));
+ dataMQ.reset(new DataMQ(d));
+ if (dataMQ->isValid() && dataMQ->getEventFlagWord()) {
+ EventFlag::createEventFlag(dataMQ->getEventFlagWord(), &efGroup);
+ }
+ }
+ }));
+ ASSERT_OK(readRes);
+ ReadParameters params;
+ params.command = IStreamIn::ReadCommand::READ;
+ ASSERT_TRUE(commandMQ != nullptr);
+ ASSERT_TRUE(commandMQ->isValid());
+ ASSERT_TRUE(commandMQ->write(¶ms));
+ efGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL));
+ uint32_t efState = 0;
+ efGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY), &efState);
+ if (efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY)) {
+ ASSERT_OK(stream->getActiveMicrophones(returnIn(res, activeMicrophones)));
+ ASSERT_OK(res);
+ ASSERT_NE(0U, activeMicrophones.size());
+ }
+ stream->close();
+ if (efGroup) {
+ EventFlag::deleteEventFlag(&efGroup);
+ }
+ }
+ }
+}
+
+TEST_F(AudioPrimaryHidlTest, SetConnectedState) {
+ doc::test("Check that the HAL can be notified of device connection and deconnection");
+ using AD = AudioDevice;
+ for (auto deviceType : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) {
+ SCOPED_TRACE("device=" + ::testing::PrintToString(deviceType));
+ for (bool state : {true, false}) {
+ SCOPED_TRACE("state=" + ::testing::PrintToString(state));
+ DeviceAddress address = {};
+ address.device = deviceType;
+ auto ret = device->setConnectedState(address, state);
+ ASSERT_TRUE(ret.isOk());
+ if (ret == Result::NOT_SUPPORTED) {
+ doc::partialTest("setConnectedState is not supported");
+ break; // other deviceType might be supported
+ }
+ ASSERT_OK(ret);
+ }
+ }
+
+ // Because there is no way of knowing if the devices were connected before
+ // calling setConnectedState, there is no way to restore the HAL to its
+ // initial state. To workaround this, destroy the HAL at the end of this test.
+ device.clear();
+ waitForDeviceDestruction();
+}
+
+static void testGetDevices(IStream* stream, AudioDevice expectedDevice) {
+ hidl_vec<DeviceAddress> devices;
+ Result res;
+ ASSERT_OK(stream->getDevices(returnIn(res, devices)));
+ if (res == Result::NOT_SUPPORTED) {
+ return doc::partialTest("GetDevices is not supported");
+ }
+ // The stream was constructed with one device, thus getDevices must only return one
+ ASSERT_EQ(1U, devices.size());
+ AudioDevice device = devices[0].device;
+ ASSERT_TRUE(device == expectedDevice)
+ << "Expected: " << ::testing::PrintToString(expectedDevice)
+ << "\n Actual: " << ::testing::PrintToString(device);
+}
+
+TEST_IO_STREAM(GetDevices, "Check that the stream device == the one it was opened with",
+ areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
+ : testGetDevices(stream.get(), address.device))
+
+static void testSetDevices(IStream* stream, const DeviceAddress& address) {
+ DeviceAddress otherAddress = address;
+ otherAddress.device = (address.device & AudioDevice::BIT_IN) == 0 ? AudioDevice::OUT_SPEAKER
+ : AudioDevice::IN_BUILTIN_MIC;
+ EXPECT_OK(stream->setDevices({otherAddress}));
+
+ ASSERT_OK(stream->setDevices({address})); // Go back to the original value
+}
+
+TEST_IO_STREAM(SetDevices, "Check that the stream can be rerouted to SPEAKER or BUILTIN_MIC",
+ areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
+ : testSetDevices(stream.get(), address))
+
+static void checkGetHwAVSync(IDevice* device) {
+ Result res;
+ AudioHwSync sync;
+ ASSERT_OK(device->getHwAvSync(returnIn(res, sync)));
+ if (res == Result::NOT_SUPPORTED) {
+ return doc::partialTest("getHwAvSync is not supported");
+ }
+ ASSERT_OK(res);
+}
+TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail", checkGetHwAVSync(device.get()));
+
+TEST_P(InputStreamTest, updateSinkMetadata) {
+ doc::test("The HAL should not crash on metadata change");
+
+ hidl_enum_range<AudioSource> range;
+ // Test all possible track configuration
+ for (AudioSource source : range) {
+ for (float volume : {0.0, 0.5, 1.0}) {
+ const SinkMetadata metadata = {{{source, volume}}};
+ ASSERT_OK(stream->updateSinkMetadata(metadata))
+ << "source=" << toString(source) << ", volume=" << volume;
+ }
+ }
+
+ // Do not test concurrent capture as this is not officially supported
+
+ // Set no metadata as if all stream track had stopped
+ ASSERT_OK(stream->updateSinkMetadata({}));
+
+ // Restore initial
+ ASSERT_OK(stream->updateSinkMetadata(initMetadata));
+}
+
+TEST_P(OutputStreamTest, SelectPresentation) {
+ doc::test("Verify that presentation selection does not crash");
+ ASSERT_RESULT(okOrNotSupported, stream->selectPresentation(0, 0));
+}
+
+TEST_P(OutputStreamTest, updateSourceMetadata) {
+ doc::test("The HAL should not crash on metadata change");
+
+ hidl_enum_range<AudioUsage> usageRange;
+ hidl_enum_range<AudioContentType> contentRange;
+ // Test all possible track configuration
+ for (auto usage : usageRange) {
+ for (auto content : contentRange) {
+ for (float volume : {0.0, 0.5, 1.0}) {
+ const SourceMetadata metadata = {{{usage, content, volume}}};
+ ASSERT_OK(stream->updateSourceMetadata(metadata))
+ << "usage=" << toString(usage) << ", content=" << toString(content)
+ << ", volume=" << volume;
+ }
+ }
+ }
+
+ // Set many track of different configuration
+ ASSERT_OK(stream->updateSourceMetadata(
+ {{{AudioUsage::MEDIA, AudioContentType::MUSIC, 0.1},
+ {AudioUsage::VOICE_COMMUNICATION, AudioContentType::SPEECH, 1.0},
+ {AudioUsage::ALARM, AudioContentType::SONIFICATION, 0.0},
+ {AudioUsage::ASSISTANT, AudioContentType::UNKNOWN, 0.3}}}));
+
+ // Set no metadata as if all stream track had stopped
+ ASSERT_OK(stream->updateSourceMetadata({}));
+
+ // Restore initial
+ ASSERT_OK(stream->updateSourceMetadata(initMetadata));
+}
+
+TEST_F(AudioPrimaryHidlTest, setMode) {
+ doc::test("Make sure setMode always succeeds if mode is valid and fails otherwise");
+ // Test Invalid values
+ for (int mode : {-2, -1, int(AudioMode::IN_COMMUNICATION) + 1}) {
+ ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(AudioMode(mode)))
+ << "mode=" << mode;
+ }
+ // Test valid values
+ for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
+ AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
+ ASSERT_OK(device->setMode(mode)) << "mode=" << toString(mode);
+ }
+}
+
+TEST_F(AudioPrimaryHidlTest, setBtHfpSampleRate) {
+ doc::test(
+ "Make sure setBtHfpSampleRate either succeeds or "
+ "indicates that it is not supported at all, or that the provided value is invalid");
+ for (auto samplingRate : {8000, 16000, 22050, 24000}) {
+ ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, device->setBtHfpSampleRate(samplingRate));
+ }
+}
+
+TEST_F(AudioPrimaryHidlTest, setBtHfpVolume) {
+ doc::test(
+ "Make sure setBtHfpVolume is either not supported or "
+ "only succeed if volume is in [0,1]");
+ auto ret = device->setBtHfpVolume(0.0);
+ ASSERT_TRUE(ret.isOk());
+ if (ret == Result::NOT_SUPPORTED) {
+ doc::partialTest("setBtHfpVolume is not supported");
+ return;
+ }
+ testUnitaryGain([](float volume) { return device->setBtHfpVolume(volume); });
+}
+
+TEST_F(AudioPrimaryHidlTest, setBtScoHeadsetDebugName) {
+ doc::test(
+ "Make sure setBtScoHeadsetDebugName either succeeds or "
+ "indicates that it is not supported");
+ ASSERT_RESULT(okOrNotSupported, device->setBtScoHeadsetDebugName("test"));
+}
+
+TEST_F(AudioPrimaryHidlTest, updateRotation) {
+ doc::test("Check that the hal can receive the current rotation");
+ for (Rotation rotation : {Rotation::DEG_0, Rotation::DEG_90, Rotation::DEG_180,
+ Rotation::DEG_270, Rotation::DEG_0}) {
+ ASSERT_RESULT(okOrNotSupported, device->updateRotation(rotation));
+ }
+}
+
+TEST_F(BoolAccessorPrimaryHidlTest, setGetBtHfpEnabled) {
+ doc::test("Query and set the BT HFP state");
+ testAccessors<OPTIONAL>("BtHfpEnabled", Initial{false, OPTIONAL}, {true},
+ &IPrimaryDevice::setBtHfpEnabled, &IPrimaryDevice::getBtHfpEnabled);
+}
diff --git a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h
new file mode 100644
index 0000000..c30f378
--- /dev/null
+++ b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include PATH(android/hardware/audio/FILE_VERSION/IStream.h)
+#include PATH(android/hardware/audio/FILE_VERSION/types.h)
+#include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
+#include <hidl/HidlSupport.h>
+
+using ::android::hardware::hidl_bitfield;
+using ::android::hardware::hidl_handle;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
+using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
+using ::android::hardware::audio::CPP_VERSION::IStream;
+using ::android::hardware::audio::CPP_VERSION::ParameterValue;
+using ::android::hardware::audio::CPP_VERSION::Result;
+
+using namespace ::android::hardware::audio::common::test::utility;
+
+using Rotation = ::android::hardware::audio::CPP_VERSION::IPrimaryDevice::Rotation;
+using ::android::hardware::audio::common::CPP_VERSION::AudioContentType;
+using ::android::hardware::audio::common::CPP_VERSION::AudioUsage;
+using ::android::hardware::audio::CPP_VERSION::MicrophoneInfo;
+using ::android::hardware::audio::CPP_VERSION::SinkMetadata;
+using ::android::hardware::audio::CPP_VERSION::SourceMetadata;
+
+struct Parameters {
+ template <class T, class ReturnIn>
+ static auto get(T t, hidl_vec<hidl_string> keys, ReturnIn returnIn) {
+ hidl_vec<ParameterValue> context;
+ return t->getParameters(context, keys, returnIn);
+ }
+ template <class T>
+ static auto set(T t, hidl_vec<ParameterValue> values) {
+ hidl_vec<ParameterValue> context;
+ return t->setParameters(context, values);
+ }
+};
+
+struct GetSupported {
+ static auto getFormat(IStream* stream) {
+ auto ret = stream->getFormat();
+ EXPECT_TRUE(ret.isOk());
+ return ret.withDefault({});
+ }
+ static Result sampleRates(IStream* stream, hidl_vec<uint32_t>& rates) {
+ Result res;
+ EXPECT_OK(stream->getSupportedSampleRates(getFormat(stream), returnIn(res, rates)));
+ return res;
+ }
+
+ static Result channelMasks(IStream* stream,
+ hidl_vec<hidl_bitfield<AudioChannelMask>>& channels) {
+ Result res;
+ EXPECT_OK(stream->getSupportedChannelMasks(getFormat(stream), returnIn(res, channels)));
+ return res;
+ }
+
+ static Result formats(IStream* stream, hidl_vec<AudioFormat>& capabilities) {
+ EXPECT_OK(stream->getSupportedFormats(returnIn(capabilities)));
+ // TODO: this should be an optional function
+ return Result::OK;
+ }
+};
+
+template <class T>
+auto dump(T t, hidl_handle handle) {
+ return t->debug(handle, {/* options */});
+}
diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp
new file mode 100644
index 0000000..519e359
--- /dev/null
+++ b/audio/core/all-versions/vts/functional/Android.bp
@@ -0,0 +1,69 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_defaults {
+ name: "VtsHalAudioTargetTest_defaults",
+ defaults: ["VtsHalTargetTestDefaults"],
+ static_libs: [
+ "android.hardware.audio.common.test.utility",
+ "libaudiopolicycomponents",
+ "libicuuc",
+ "libicuuc_stubdata",
+ "libmedia_helper",
+ "libxml2",
+ ],
+ shared_libs: [
+ "libfmq",
+ ],
+ header_libs: [
+ "android.hardware.audio.common.util@all-versions",
+ ],
+ test_suites: ["general-tests"],
+}
+
+cc_test {
+ name: "VtsHalAudioV2_0TargetTest",
+ defaults: ["VtsHalAudioTargetTest_defaults"],
+ srcs: [
+ "2.0/AudioPrimaryHidlHalTest.cpp",
+ ],
+ static_libs: [
+ "android.hardware.audio@2.0",
+ "android.hardware.audio.common@2.0",
+ ],
+ cflags: [
+ "-DMAJOR_VERSION=2",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
+}
+
+cc_test {
+ name: "VtsHalAudioV4_0TargetTest",
+ defaults: ["VtsHalAudioTargetTest_defaults"],
+ srcs: [
+ "4.0/AudioPrimaryHidlHalTest.cpp",
+ ],
+ static_libs: [
+ "android.hardware.audio@4.0",
+ "android.hardware.audio.common@4.0",
+ ],
+ cflags: [
+ "-DMAJOR_VERSION=4",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
+}
diff --git a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
similarity index 72%
rename from audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
rename to audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
index f1e0b21..24f4238 100644
--- a/audio/core/4.0/vts/functional/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalAudioV4_0TargetTest"
+#define LOG_TAG "VtsHalAudioVTargetTest"
#include <algorithm>
#include <cmath>
@@ -35,11 +35,13 @@
#include <android-base/logging.h>
-#include <android/hardware/audio/4.0/IDevice.h>
-#include <android/hardware/audio/4.0/IDevicesFactory.h>
-#include <android/hardware/audio/4.0/IPrimaryDevice.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/IDevice.h)
+#include PATH(android/hardware/audio/FILE_VERSION/IDevicesFactory.h)
+#include PATH(android/hardware/audio/FILE_VERSION/IPrimaryDevice.h)
+#include PATH(android/hardware/audio/FILE_VERSION/types.h)
+#include PATH(android/hardware/audio/common/FILE_VERSION/types.h)
+
+#include <Serializer.h>
#include <fmq/EventFlag.h>
#include <fmq/MessageQueue.h>
@@ -48,17 +50,29 @@
#include "utility/AssertOk.h"
#include "utility/Documentation.h"
#include "utility/EnvironmentTearDown.h"
-#define AUDIO_HAL_VERSION V4_0
#include "utility/PrettyPrintAudioTypes.h"
#include "utility/ReturnIn.h"
+#include "utility/ValidateXml.h"
+
+/** Provide version specific functions that are used in the generic tests */
+#if MAJOR_VERSION == 2
+#include "2.0/AudioPrimaryHidlHalUtils.h"
+#elif MAJOR_VERSION == 4
+#include "4.0/AudioPrimaryHidlHalUtils.h"
+#endif
using std::initializer_list;
+using std::list;
using std::string;
using std::to_string;
using std::vector;
-using std::list;
+using ::android::AudioPolicyConfig;
+using ::android::HwModule;
+using ::android::NO_INIT;
+using ::android::OK;
using ::android::sp;
+using ::android::status_t;
using ::android::hardware::EventFlag;
using ::android::hardware::hidl_bitfield;
using ::android::hardware::hidl_enum_range;
@@ -70,44 +84,38 @@
using ::android::hardware::MessageQueue;
using ::android::hardware::MQDescriptorSync;
using ::android::hardware::Return;
-using ::android::hardware::audio::V4_0::AudioDrain;
-using ::android::hardware::audio::V4_0::DeviceAddress;
-using ::android::hardware::audio::V4_0::IDevice;
-using ::android::hardware::audio::V4_0::IPrimaryDevice;
-using Rotation = ::android::hardware::audio::V4_0::IPrimaryDevice::Rotation;
-using TtyMode = ::android::hardware::audio::V4_0::IPrimaryDevice::TtyMode;
-using ::android::hardware::audio::V4_0::IDevicesFactory;
-using ::android::hardware::audio::V4_0::IStream;
-using ::android::hardware::audio::V4_0::IStreamIn;
-using ::android::hardware::audio::V4_0::MessageQueueFlagBits;
-using ::android::hardware::audio::V4_0::TimeSpec;
-using ReadParameters = ::android::hardware::audio::V4_0::IStreamIn::ReadParameters;
-using ReadStatus = ::android::hardware::audio::V4_0::IStreamIn::ReadStatus;
-using ::android::hardware::audio::V4_0::IStreamOut;
-using ::android::hardware::audio::V4_0::IStreamOutCallback;
-using ::android::hardware::audio::V4_0::MicrophoneInfo;
-using ::android::hardware::audio::V4_0::MmapBufferInfo;
-using ::android::hardware::audio::V4_0::MmapPosition;
-using ::android::hardware::audio::V4_0::ParameterValue;
-using ::android::hardware::audio::V4_0::Result;
-using ::android::hardware::audio::V4_0::SourceMetadata;
-using ::android::hardware::audio::V4_0::SinkMetadata;
-using ::android::hardware::audio::common::V4_0::AudioChannelMask;
-using ::android::hardware::audio::common::V4_0::AudioConfig;
-using ::android::hardware::audio::common::V4_0::AudioContentType;
-using ::android::hardware::audio::common::V4_0::AudioDevice;
-using ::android::hardware::audio::common::V4_0::AudioFormat;
-using ::android::hardware::audio::common::V4_0::AudioHandleConsts;
-using ::android::hardware::audio::common::V4_0::AudioHwSync;
-using ::android::hardware::audio::common::V4_0::AudioInputFlag;
-using ::android::hardware::audio::common::V4_0::AudioIoHandle;
-using ::android::hardware::audio::common::V4_0::AudioMode;
-using ::android::hardware::audio::common::V4_0::AudioOffloadInfo;
-using ::android::hardware::audio::common::V4_0::AudioOutputFlag;
-using ::android::hardware::audio::common::V4_0::AudioSource;
-using ::android::hardware::audio::common::V4_0::AudioUsage;
-using ::android::hardware::audio::common::V4_0::ThreadInfo;
-using ::android::hardware::audio::common::utils::mkBitfield;
+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::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;
@@ -120,6 +128,10 @@
static auto invalidArgsOrNotSupported = {Result::INVALID_ARGUMENTS, Result::NOT_SUPPORTED};
static auto invalidStateOrNotSupported = {Result::INVALID_STATE, Result::NOT_SUPPORTED};
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////// Environment /////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
class AudioHidlTestEnvironment : public ::Environment {
public:
virtual void registerTestServices() override { registerTestService<IDevicesFactory>(); }
@@ -135,11 +147,103 @@
};
//////////////////////////////////////////////////////////////////////////////
+////////////////////////// Audio policy configuration ////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+static const std::vector<const char*> kConfigLocations = {"/odm/etc", "/vendor/etc", "/system/etc"};
+static constexpr char kConfigFileName[] = "audio_policy_configuration.xml";
+
+// Stringify the argument.
+#define QUOTE(x) #x
+#define STRINGIFY(x) QUOTE(x)
+
+TEST(CheckConfig, audioPolicyConfigurationValidation) {
+ RecordProperty("description",
+ "Verify that the audio policy configuration file "
+ "is valid according to the schema");
+
+ const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd";
+ EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(kConfigFileName, kConfigLocations, xsd);
+}
+
+struct PolicyConfigData {
+ android::HwModuleCollection hwModules;
+ android::DeviceVector availableOutputDevices;
+ android::DeviceVector availableInputDevices;
+ sp<android::DeviceDescriptor> defaultOutputDevice;
+ android::VolumeCurvesCollection volumes;
+};
+
+class PolicyConfig : private PolicyConfigData, public AudioPolicyConfig {
+ public:
+ PolicyConfig()
+ : AudioPolicyConfig(hwModules, availableOutputDevices, availableInputDevices,
+ defaultOutputDevice, &volumes) {
+ for (const char* location : kConfigLocations) {
+ std::string path = std::string(location) + '/' + kConfigFileName;
+ if (access(path.c_str(), F_OK) == 0) {
+ mFilePath = path;
+ break;
+ }
+ }
+ mStatus = android::deserializeAudioPolicyFile(mFilePath.c_str(), this);
+ if (mStatus == OK) {
+ mPrimaryModule = getHwModules().getModuleFromName("primary");
+ }
+ }
+ status_t getStatus() const { return mStatus; }
+ std::string getError() const {
+ if (mFilePath.empty()) {
+ return std::string{"Could not find "} + kConfigFileName +
+ " file in: " + testing::PrintToString(kConfigLocations);
+ } else {
+ return "Invalid config file: " + mFilePath;
+ }
+ }
+ const std::string& getFilePath() const { return mFilePath; }
+ sp<const HwModule> getPrimaryModule() const { return mPrimaryModule; }
+
+ private:
+ status_t mStatus = NO_INIT;
+ std::string mFilePath;
+ sp<HwModule> mPrimaryModule = nullptr;
+};
+
+// Cached policy config after parsing for faster test startup
+const PolicyConfig& getCachedPolicyConfig() {
+ static std::unique_ptr<PolicyConfig> policyConfig = [] {
+ auto config = std::make_unique<PolicyConfig>();
+ environment->registerTearDown([] { policyConfig.reset(); });
+ return config;
+ }();
+ return *policyConfig;
+}
+
+class AudioPolicyConfigTest : public HidlTest {
+ public:
+ void SetUp() override {
+ ASSERT_NO_FATAL_FAILURE(HidlTest::SetUp()); // setup base
+
+ auto& policyConfig = getCachedPolicyConfig();
+ ASSERT_EQ(0, policyConfig.getStatus()) << policyConfig.getError();
+
+ mPrimaryConfig = policyConfig.getPrimaryModule();
+ ASSERT_TRUE(mPrimaryConfig) << "Could not find primary module in configuration file: "
+ << policyConfig.getFilePath();
+ }
+ sp<const HwModule> mPrimaryConfig = nullptr;
+};
+
+TEST_F(AudioPolicyConfigTest, LoadAudioPolicyXMLConfiguration) {
+ doc::test("Test parsing audio_policy_configuration.xml (called in SetUp)");
+}
+
+//////////////////////////////////////////////////////////////////////////////
////////////////////// getService audio_devices_factory //////////////////////
//////////////////////////////////////////////////////////////////////////////
// Test all audio devices
-class AudioHidlTest : public HidlTest {
+class AudioHidlTest : public AudioPolicyConfigTest {
public:
void SetUp() override {
ASSERT_NO_FATAL_FAILURE(HidlTest::SetUp()); // setup base
@@ -166,34 +270,16 @@
doc::test("Test passing an invalid parameter to openDevice");
Result result;
sp<IDevice> device;
- ASSERT_OK(devicesFactory->openDevice("Non existing device", returnIn(result, 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);
}
-TEST_F(AudioHidlTest, OpenPrimaryDeviceUsingGetDevice) {
- doc::test("Calling openDevice(\"primary\") should return the primary device.");
- {
- Result result;
- sp<IDevice> baseDevice;
- ASSERT_OK(devicesFactory->openDevice("primary", returnIn(result, baseDevice)));
- ASSERT_OK(result);
- ASSERT_TRUE(baseDevice != nullptr);
-
- Return<sp<IPrimaryDevice>> primaryDevice = IPrimaryDevice::castFrom(baseDevice);
- ASSERT_TRUE(primaryDevice.isOk());
- ASSERT_TRUE(sp<IPrimaryDevice>(primaryDevice) != nullptr);
- } // Destroy local IDevice proxy
- // FIXME: there is no way to know when the remote IDevice is being destroyed
- // Binder does not support testing if an object is alive, thus
- // wait for 100ms to let the binder destruction propagates and
- // the remote device has the time to be destroyed.
- // flushCommand makes sure all local command are sent, thus should reduce
- // the latency between local and remote destruction.
- IPCThreadState::self()->flushCommands();
- usleep(100);
-}
-
//////////////////////////////////////////////////////////////////////////////
/////////////////////////////// openDevice primary ///////////////////////////
//////////////////////////////////////////////////////////////////////////////
@@ -206,11 +292,8 @@
ASSERT_NO_FATAL_FAILURE(AudioHidlTest::SetUp()); // setup base
if (device == nullptr) {
- Result result;
- ASSERT_OK(devicesFactory->openPrimaryDevice(returnIn(result, device)));
- ASSERT_OK(result);
+ initPrimaryDevice();
ASSERT_TRUE(device != nullptr);
-
environment->registerTearDown([] { device.clear(); });
}
}
@@ -218,6 +301,23 @@
protected:
// Cache the device opening to speed up each test by ~0.5s
static sp<IPrimaryDevice> device;
+
+ private:
+ void initPrimaryDevice() {
+ Result result;
+#if MAJOR_VERSION == 2
+ sp<IDevice> baseDevice;
+ ASSERT_OK(devicesFactory->openDevice(IDevicesFactory::Device::PRIMARY,
+ returnIn(result, baseDevice)));
+ ASSERT_OK(result);
+ ASSERT_TRUE(baseDevice != nullptr);
+
+ device = IPrimaryDevice::castFrom(baseDevice);
+#elif MAJOR_VERSION >= 4
+ ASSERT_OK(devicesFactory->openPrimaryDevice(returnIn(result, device)));
+ ASSERT_OK(result);
+#endif
+ }
};
sp<IPrimaryDevice> AudioPrimaryHidlTest::device;
@@ -350,6 +450,20 @@
class AudioConfigPrimaryTest : public AudioPatchPrimaryHidlTest {
public:
+ // for retro compatibility only test the primary device IN_BUILTIN_MIC
+ // FIXME: in the next audio HAL version, test all available devices
+ static bool primaryHasMic() {
+ auto& policyConfig = getCachedPolicyConfig();
+ if (policyConfig.getStatus() != OK || policyConfig.getPrimaryModule() == nullptr) {
+ return true; // Could not get the information, run all tests
+ }
+ auto getMic = [](auto& devs) { return devs.getDevice(AUDIO_DEVICE_IN_BUILTIN_MIC, {}); };
+ auto primaryMic = getMic(policyConfig.getPrimaryModule()->getDeclaredDevices());
+ auto availableMic = getMic(policyConfig.getAvailableInputDevices());
+
+ return primaryMic != nullptr && primaryMic->equals(availableMic);
+ }
+
// Cache result ?
static const vector<AudioConfig> getRequiredSupportPlaybackAudioConfig() {
return combineAudioConfig({AudioChannelMask::OUT_STEREO, AudioChannelMask::OUT_MONO},
@@ -369,10 +483,12 @@
}
static const vector<AudioConfig> getRequiredSupportCaptureAudioConfig() {
+ if (!primaryHasMic()) return {};
return combineAudioConfig({AudioChannelMask::IN_MONO}, {8000, 11025, 16000, 44100},
{AudioFormat::PCM_16_BIT});
}
static const vector<AudioConfig> getRecommendedSupportCaptureAudioConfig() {
+ if (!primaryHasMic()) return {};
return combineAudioConfig({AudioChannelMask::IN_STEREO}, {22050, 48000},
{AudioFormat::PCM_16_BIT});
}
@@ -392,7 +508,7 @@
for (auto format : formats) {
AudioConfig config{};
// leave offloadInfo to 0
- config.channelMask = mkBitfield(channelMask);
+ config.channelMask = mkEnumBitfield(channelMask);
config.sampleRateHz = sampleRate;
config.format = format;
// FIXME: leave frameCount to 0 ?
@@ -413,8 +529,8 @@
const AudioConfig& config = info.param;
return to_string(info.index) + "__" + to_string(config.sampleRateHz) + "_" +
// "MONO" is more clear than "FRONT_LEFT"
- ((config.channelMask == mkBitfield(AudioChannelMask::OUT_MONO) ||
- config.channelMask == mkBitfield(AudioChannelMask::IN_MONO))
+ ((config.channelMask == mkEnumBitfield(AudioChannelMask::OUT_MONO) ||
+ config.channelMask == mkEnumBitfield(AudioChannelMask::IN_MONO))
? "MONO"
: ::testing::PrintToString(config.channelMask));
}
@@ -501,91 +617,10 @@
hidl_vec<ParameterValue> context;
hidl_vec<hidl_string> keys;
hidl_vec<ParameterValue> values;
- ASSERT_OK(device->getParameters(context, keys, returnIn(res, values)));
- ASSERT_OK(device->setParameters(context, values));
+ ASSERT_OK(Parameters::get(device, keys, returnIn(res, values)));
+ ASSERT_OK(Parameters::set(device, values));
values.resize(0);
- ASSERT_OK(device->setParameters(context, values));
-}
-
-//////////////////////////////////////////////////////////////////////////////
-/////////////////////////// get(Active)Microphones ///////////////////////////
-//////////////////////////////////////////////////////////////////////////////
-
-TEST_F(AudioPrimaryHidlTest, GetMicrophonesTest) {
- doc::test("Make sure getMicrophones always succeeds");
- hidl_vec<MicrophoneInfo> microphones;
- ASSERT_OK(device->getMicrophones(returnIn(res, microphones)));
- ASSERT_OK(res);
- if (microphones.size() > 0) {
- // When there is microphone on the phone, try to open an input stream
- // and query for the active microphones.
- doc::test(
- "Make sure getMicrophones always succeeds"
- "and getActiveMicrophones always succeeds when recording from these microphones.");
- AudioIoHandle ioHandle = (AudioIoHandle)AudioHandleConsts::AUDIO_IO_HANDLE_NONE;
- AudioConfig config{};
- config.channelMask = mkBitfield(AudioChannelMask::IN_MONO);
- config.sampleRateHz = 8000;
- config.format = AudioFormat::PCM_16_BIT;
- auto flags = hidl_bitfield<AudioInputFlag>(AudioInputFlag::NONE);
- const SinkMetadata initialMetadata = {{{AudioSource::MIC, 1 /* gain */}}};
- EventFlag* efGroup;
- for (auto microphone : microphones) {
- if (microphone.deviceAddress.device != AudioDevice::IN_BUILTIN_MIC) {
- continue;
- }
- sp<IStreamIn> stream;
- AudioConfig suggestedConfig{};
- ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress, config, flags,
- initialMetadata,
- returnIn(res, stream, suggestedConfig)));
- if (res != Result::OK) {
- ASSERT_TRUE(stream == nullptr);
- AudioConfig suggestedConfigRetry{};
- ASSERT_OK(device->openInputStream(ioHandle, microphone.deviceAddress,
- suggestedConfig, flags, initialMetadata,
- returnIn(res, stream, suggestedConfigRetry)));
- }
- ASSERT_OK(res);
- hidl_vec<MicrophoneInfo> activeMicrophones;
- Result readRes;
- typedef MessageQueue<ReadParameters, kSynchronizedReadWrite> CommandMQ;
- typedef MessageQueue<uint8_t, kSynchronizedReadWrite> DataMQ;
- std::unique_ptr<CommandMQ> commandMQ;
- std::unique_ptr<DataMQ> dataMQ;
- size_t frameSize = stream->getFrameSize();
- size_t frameCount = stream->getBufferSize() / frameSize;
- ASSERT_OK(stream->prepareForReading(
- frameSize, frameCount, [&](auto r, auto& c, auto& d, auto&, auto&) {
- readRes = r;
- if (readRes == Result::OK) {
- commandMQ.reset(new CommandMQ(c));
- dataMQ.reset(new DataMQ(d));
- if (dataMQ->isValid() && dataMQ->getEventFlagWord()) {
- EventFlag::createEventFlag(dataMQ->getEventFlagWord(), &efGroup);
- }
- }
- }));
- ASSERT_OK(readRes);
- ReadParameters params;
- params.command = IStreamIn::ReadCommand::READ;
- ASSERT_TRUE(commandMQ != nullptr);
- ASSERT_TRUE(commandMQ->isValid());
- ASSERT_TRUE(commandMQ->write(¶ms));
- efGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL));
- uint32_t efState = 0;
- efGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY), &efState);
- if (efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY)) {
- ASSERT_OK(stream->getActiveMicrophones(returnIn(res, activeMicrophones)));
- ASSERT_OK(res);
- ASSERT_NE(0U, activeMicrophones.size());
- }
- stream->close();
- if (efGroup) {
- EventFlag::deleteEventFlag(&efGroup);
- }
- }
- }
+ ASSERT_OK(Parameters::set(device, values));
}
//////////////////////////////////////////////////////////////////////////////
@@ -628,32 +663,12 @@
TEST_F(AudioPrimaryHidlTest, DebugDump) {
doc::test("Check that the hal can dump its state without error");
- testDebugDump([](const auto& handle) { return device->debug(handle, {/* options */}); });
+ testDebugDump([](const auto& handle) { return dump(device, handle); });
}
TEST_F(AudioPrimaryHidlTest, DebugDumpInvalidArguments) {
doc::test("Check that the hal dump doesn't crash on invalid arguments");
- ASSERT_OK(device->debug(hidl_handle(), {/* options */}));
-}
-
-TEST_F(AudioPrimaryHidlTest, SetConnectedState) {
- doc::test("Check that the HAL can be notified of device connection and deconnection");
- using AD = AudioDevice;
- for (auto deviceType : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) {
- SCOPED_TRACE("device=" + ::testing::PrintToString(deviceType));
- for (bool state : {true, false}) {
- SCOPED_TRACE("state=" + ::testing::PrintToString(state));
- DeviceAddress address = {};
- address.device = deviceType;
- auto ret = device->setConnectedState(address, state);
- ASSERT_TRUE(ret.isOk());
- if (ret == Result::NOT_SUPPORTED) {
- doc::partialTest("setConnectedState is not supported");
- return;
- }
- ASSERT_OK(ret);
- }
- }
+ ASSERT_OK(dump(device, hidl_handle()));
}
//////////////////////////////////////////////////////////////////////////////
@@ -723,18 +738,25 @@
address.device = AudioDevice::OUT_DEFAULT;
const AudioConfig& config = GetParam();
// TODO: test all flag combination
- auto flags = hidl_bitfield<AudioOutputFlag>(AudioOutputFlag::NONE);
+ auto flags = mkEnumBitfield(AudioOutputFlag::NONE);
testOpen(
[&](AudioIoHandle handle, AudioConfig config, auto cb) {
- return device->openOutputStream(handle, address, config, flags, initialMetadata,
- 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 initialMetadata = {
- {{AudioUsage::MEDIA, AudioContentType::MUSIC, 1 /* gain */}}};
+ const SourceMetadata initMetadata = {
+ { { AudioUsage::MEDIA,
+ AudioContentType::MUSIC,
+ 1 /* gain */ } }};
+#endif
};
TEST_P(OutputStreamTest, OpenOutputStreamTest) {
doc::test(
@@ -764,16 +786,20 @@
address.device = AudioDevice::IN_DEFAULT;
const AudioConfig& config = GetParam();
// TODO: test all supported flags and source
- auto flags = hidl_bitfield<AudioInputFlag>(AudioInputFlag::NONE);
+ auto flags = mkEnumBitfield(AudioInputFlag::NONE);
testOpen(
[&](AudioIoHandle handle, AudioConfig config, auto cb) {
- return device->openInputStream(handle, address, config, flags, initialMetadata, cb);
+ return device->openInputStream(handle, address, config, flags, initMetadata, cb);
},
config);
}
protected:
- const SinkMetadata initialMetadata = {{{AudioSource::DEFAULT, 1 /* gain */}}};
+#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) {
@@ -842,19 +868,20 @@
TEST_IO_STREAM(GetBufferSize, "Check that the stream buffer size== the one it was opened with",
ASSERT_GE(extract(stream->getBufferSize()), extract(stream->getFrameSize())));
-template <class Property, class CapablityGetter>
+template <class Property, class CapabilityGetter>
static void testCapabilityGetter(const string& name, IStream* stream,
- CapablityGetter capablityGetter,
+ CapabilityGetter capabilityGetter,
Return<Property> (IStream::*getter)(),
Return<Result> (IStream::*setter)(Property),
bool currentMustBeSupported = true) {
hidl_vec<Property> capabilities;
- auto ret = capablityGetter(stream, capabilities);
- if (ret == Result::NOT_SUPPORTED) {
+ auto ret = capabilityGetter(stream, capabilities);
+ ASSERT_RESULT(okOrNotSupported, ret);
+ bool notSupported = ret == Result::NOT_SUPPORTED;
+ if (notSupported) {
doc::partialTest(name + " is not supported");
return;
};
- ASSERT_OK(ret);
if (currentMustBeSupported) {
ASSERT_NE(0U, capabilities.size()) << name << " must not return an empty list";
@@ -878,29 +905,9 @@
}
}
-Result getSupportedSampleRates(IStream* stream, hidl_vec<uint32_t>& rates) {
- Result res;
- EXPECT_OK(stream->getSupportedSampleRates(extract(stream->getFormat()), returnIn(res, rates)));
- return res;
-}
-
-Result getSupportedChannelMasks(IStream* stream,
- hidl_vec<hidl_bitfield<AudioChannelMask>>& channels) {
- Result res;
- EXPECT_OK(
- stream->getSupportedChannelMasks(extract(stream->getFormat()), returnIn(res, channels)));
- return res;
-}
-
-Result getSupportedFormats(IStream* stream, hidl_vec<AudioFormat>& capabilities) {
- EXPECT_OK(stream->getSupportedFormats(returnIn(capabilities)));
- // TODO: this should be an optional function
- return Result::OK;
-}
-
TEST_IO_STREAM(SupportedSampleRate, "Check that the stream sample rate is declared as supported",
testCapabilityGetter("getSupportedSampleRate", stream.get(),
- &getSupportedSampleRates, &IStream::getSampleRate,
+ &GetSupported::sampleRates, &IStream::getSampleRate,
&IStream::setSampleRate,
// getSupportedSampleRate returns the native sampling rates,
// (the sampling rates that can be played without resampling)
@@ -909,48 +916,16 @@
TEST_IO_STREAM(SupportedChannelMask, "Check that the stream channel mask is declared as supported",
testCapabilityGetter("getSupportedChannelMask", stream.get(),
- &getSupportedChannelMasks, &IStream::getChannelMask,
+ &GetSupported::channelMasks, &IStream::getChannelMask,
&IStream::setChannelMask))
TEST_IO_STREAM(SupportedFormat, "Check that the stream format is declared as supported",
- testCapabilityGetter("getSupportedFormat", stream.get(), &getSupportedFormats,
+ testCapabilityGetter("getSupportedFormat", stream.get(), &GetSupported::formats,
&IStream::getFormat, &IStream::setFormat))
-static void testGetDevices(IStream* stream, AudioDevice expectedDevice) {
- hidl_vec<DeviceAddress> devices;
- Result res;
- ASSERT_OK(stream->getDevices(returnIn(res, devices)));
- if (res == Result::NOT_SUPPORTED) {
- return doc::partialTest("GetDevices is not supported");
- }
- // The stream was constructed with one device, thus getDevices must only return one
- ASSERT_EQ(1U, devices.size());
- AudioDevice device = devices[0].device;
- ASSERT_TRUE(device == expectedDevice)
- << "Expected: " << ::testing::PrintToString(expectedDevice)
- << "\n Actual: " << ::testing::PrintToString(device);
-}
-
-TEST_IO_STREAM(GetDevices, "Check that the stream device == the one it was opened with",
- areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
- : testGetDevices(stream.get(), address.device))
-
-static void testSetDevices(IStream* stream, const DeviceAddress& address) {
- DeviceAddress otherAddress = address;
- otherAddress.device = (address.device & AudioDevice::BIT_IN) == 0 ? AudioDevice::OUT_SPEAKER
- : AudioDevice::IN_BUILTIN_MIC;
- EXPECT_OK(stream->setDevices({otherAddress}));
-
- ASSERT_OK(stream->setDevices({address})); // Go back to the original value
-}
-
-TEST_IO_STREAM(SetDevices, "Check that the stream can be rerouted to SPEAKER or BUILTIN_MIC",
- areAudioPatchesSupported() ? doc::partialTest("Audio patches are supported")
- : testSetDevices(stream.get(), address))
-
static void testGetAudioProperties(IStream* stream, AudioConfig expectedConfig) {
uint32_t sampleRateHz;
- hidl_bitfield<AudioChannelMask> mask;
+ auto mask = mkEnumBitfield<AudioChannelMask>({});
AudioFormat format;
stream->getAudioProperties(returnIn(sampleRateHz, mask, format));
@@ -969,23 +944,11 @@
TEST_IO_STREAM(SetHwAvSync, "Try to set hardware sync to an invalid value",
ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, stream->setHwAvSync(666)))
-static void checkGetHwAVSync(IDevice* device) {
- Result res;
- AudioHwSync sync;
- ASSERT_OK(device->getHwAvSync(returnIn(res, sync)));
- if (res == Result::NOT_SUPPORTED) {
- return doc::partialTest("getHwAvSync is not supported");
- }
- ASSERT_OK(res);
-}
-TEST_IO_STREAM(GetHwAvSync, "Get hardware sync can not fail", checkGetHwAVSync(device.get()));
-
static void checkGetNoParameter(IStream* stream, hidl_vec<hidl_string> keys,
initializer_list<Result> expectedResults) {
- hidl_vec<ParameterValue> context;
hidl_vec<ParameterValue> parameters;
Result res;
- ASSERT_OK(stream->getParameters(context, keys, returnIn(res, parameters)));
+ ASSERT_OK(Parameters::get(stream, keys, returnIn(res, parameters)));
ASSERT_RESULT(expectedResults, res);
if (res == Result::OK) {
for (auto& parameter : parameters) {
@@ -1006,7 +969,7 @@
{Result::NOT_SUPPORTED}))
TEST_IO_STREAM(setEmptySetParameter, "Set the values of an empty set of parameters",
- ASSERT_RESULT(Result::OK, stream->setParameters({}, {})))
+ ASSERT_RESULT(Result::OK, Parameters::set(stream, {})))
TEST_IO_STREAM(setNonExistingParameter, "Set the values of an non existing parameter",
// Unfortunately, the set_parameter legacy interface did not return any
@@ -1014,14 +977,14 @@
// To allow implementation to just wrapped the legacy one, consider OK as a
// valid result for setting a non existing parameter.
ASSERT_RESULT(okOrNotSupportedOrInvalidArgs,
- stream->setParameters({}, {{"non existing key", "0"}})))
+ Parameters::set(stream, {{"non existing key", "0"}})))
TEST_IO_STREAM(DebugDump, "Check that a stream can dump its state without error",
- testDebugDump([this](const auto& handle) { return stream->debug(handle, {}); }))
+ testDebugDump([this](const auto& handle) { return dump(stream, handle); }))
TEST_IO_STREAM(DebugDumpInvalidArguments,
"Check that the stream dump doesn't crash on invalid arguments",
- ASSERT_OK(stream->debug(hidl_handle(), {})))
+ ASSERT_OK(dump(stream, hidl_handle())))
//////////////////////////////////////////////////////////////////////////////
////////////////////////////// addRemoveEffect ///////////////////////////////
@@ -1171,28 +1134,6 @@
}
}
-TEST_P(InputStreamTest, updateSinkMetadata) {
- doc::test("The HAL should not crash on metadata change");
-
- hidl_enum_range<AudioSource> range;
- // Test all possible track configuration
- for (AudioSource source : range) {
- for (float volume : {0.0, 0.5, 1.0}) {
- const SinkMetadata metadata = {{{source, volume}}};
- ASSERT_OK(stream->updateSinkMetadata(metadata))
- << "source=" << toString(source) << ", volume=" << volume;
- }
- }
-
- // Do not test concurrent capture as this is not officially supported
-
- // Set no metadata as if all stream track had stopped
- ASSERT_OK(stream->updateSinkMetadata({}));
-
- // Restore initial
- ASSERT_OK(stream->updateSinkMetadata(initialMetadata));
-}
-
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////// StreamOut //////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
@@ -1410,42 +1351,6 @@
ASSERT_PRED2([](auto c, auto m) { return c - m < 1e+6; }, currentTime, mesureTime);
}
-TEST_P(OutputStreamTest, SelectPresentation) {
- doc::test("Verify that presentation selection does not crash");
- ASSERT_RESULT(okOrNotSupported, stream->selectPresentation(0, 0));
-}
-
-TEST_P(OutputStreamTest, updateSourceMetadata) {
- doc::test("The HAL should not crash on metadata change");
-
- hidl_enum_range<AudioUsage> usageRange;
- hidl_enum_range<AudioContentType> contentRange;
- // Test all possible track configuration
- for (auto usage : usageRange) {
- for (auto content : contentRange) {
- for (float volume : {0.0, 0.5, 1.0}) {
- const SourceMetadata metadata = {{{usage, content, volume}}};
- ASSERT_OK(stream->updateSourceMetadata(metadata))
- << "usage=" << toString(usage) << ", content=" << toString(content)
- << ", volume=" << volume;
- }
- }
- }
-
- // Set many track of different configuration
- ASSERT_OK(stream->updateSourceMetadata(
- {{{AudioUsage::MEDIA, AudioContentType::MUSIC, 0.1},
- {AudioUsage::VOICE_COMMUNICATION, AudioContentType::SPEECH, 1.0},
- {AudioUsage::ALARM, AudioContentType::SONIFICATION, 0.0},
- {AudioUsage::ASSISTANT, AudioContentType::UNKNOWN, 0.3}}}));
-
- // Set no metadata as if all stream track had stopped
- ASSERT_OK(stream->updateSourceMetadata({}));
-
- // Restore initial
- ASSERT_OK(stream->updateSourceMetadata(initialMetadata));
-}
-
//////////////////////////////////////////////////////////////////////////////
/////////////////////////////// PrimaryDevice ////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
@@ -1455,57 +1360,6 @@
testUnitaryGain([](float volume) { return device->setVoiceVolume(volume); });
}
-TEST_F(AudioPrimaryHidlTest, setMode) {
- doc::test("Make sure setMode always succeeds if mode is valid and fails otherwise");
- // Test Invalid values
- for (int mode : {-2, -1, int(AudioMode::IN_COMMUNICATION) + 1}) {
- ASSERT_RESULT(Result::INVALID_ARGUMENTS, device->setMode(AudioMode(mode)))
- << "mode=" << mode;
- }
- // Test valid values
- for (AudioMode mode : {AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION, AudioMode::RINGTONE,
- AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
- ASSERT_OK(device->setMode(mode)) << "mode=" << toString(mode);
- }
-}
-
-TEST_F(AudioPrimaryHidlTest, setBtHfpSampleRate) {
- doc::test(
- "Make sure setBtHfpSampleRate either succeeds or "
- "indicates that it is not supported at all, or that the provided value is invalid");
- for (auto samplingRate : {8000, 16000, 22050, 24000}) {
- ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, device->setBtHfpSampleRate(samplingRate));
- }
-}
-
-TEST_F(AudioPrimaryHidlTest, setBtHfpVolume) {
- doc::test(
- "Make sure setBtHfpVolume is either not supported or "
- "only succeed if volume is in [0,1]");
- auto ret = device->setBtHfpVolume(0.0);
- ASSERT_TRUE(ret.isOk());
- if (ret == Result::NOT_SUPPORTED) {
- doc::partialTest("setBtHfpVolume is not supported");
- return;
- }
- testUnitaryGain([](float volume) { return device->setBtHfpVolume(volume); });
-}
-
-TEST_F(AudioPrimaryHidlTest, setBtScoHeadsetDebugName) {
- doc::test(
- "Make sure setBtScoHeadsetDebugName either succeeds or "
- "indicates that it is not supported");
- ASSERT_RESULT(okOrNotSupported, device->setBtScoHeadsetDebugName("test"));
-}
-
-TEST_F(AudioPrimaryHidlTest, updateRotation) {
- doc::test("Check that the hal can receive the current rotation");
- for (Rotation rotation : {Rotation::DEG_0, Rotation::DEG_90, Rotation::DEG_180,
- Rotation::DEG_270, Rotation::DEG_0}) {
- ASSERT_RESULT(okOrNotSupported, device->updateRotation(rotation));
- }
-}
-
TEST_F(BoolAccessorPrimaryHidlTest, BtScoNrecEnabled) {
doc::test("Query and set the BT SCO NR&EC state");
testAccessors<OPTIONAL>("BtScoNrecEnabled", Initial{false, OPTIONAL}, {true},
@@ -1520,12 +1374,6 @@
&IPrimaryDevice::getBtScoWidebandEnabled);
}
-TEST_F(BoolAccessorPrimaryHidlTest, setGetBtHfpEnabled) {
- doc::test("Query and set the BT HFP state");
- testAccessors<OPTIONAL>("BtHfpEnabled", Initial{false, OPTIONAL}, {true},
- &IPrimaryDevice::setBtHfpEnabled, &IPrimaryDevice::getBtHfpEnabled);
-}
-
using TtyModeAccessorPrimaryHidlTest = AccessorPrimaryHidlTest<TtyMode>;
TEST_F(TtyModeAccessorPrimaryHidlTest, setGetTtyMode) {
doc::test("Query and set the TTY mode state");
diff --git a/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp b/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp
deleted file mode 100644
index cadc2f1..0000000
--- a/audio/effect/2.0/default/AcousticEchoCancelerEffect.cpp
+++ /dev/null
@@ -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
diff --git a/audio/effect/2.0/default/AcousticEchoCancelerEffect.h b/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
deleted file mode 100644
index d36335c..0000000
--- a/audio/effect/2.0/default/AcousticEchoCancelerEffect.h
+++ /dev/null
@@ -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
diff --git a/audio/effect/2.0/default/Android.bp b/audio/effect/2.0/default/Android.bp
deleted file mode 100644
index db00988..0000000
--- a/audio/effect/2.0/default/Android.bp
+++ /dev/null
@@ -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",
- ],
-}
diff --git a/audio/effect/2.0/default/AudioBufferManager.cpp b/audio/effect/2.0/default/AudioBufferManager.cpp
deleted file mode 100644
index 39918dd..0000000
--- a/audio/effect/2.0/default/AudioBufferManager.cpp
+++ /dev/null
@@ -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
diff --git a/audio/effect/2.0/default/AudioBufferManager.h b/audio/effect/2.0/default/AudioBufferManager.h
deleted file mode 100644
index 789fbd1..0000000
--- a/audio/effect/2.0/default/AudioBufferManager.h
+++ /dev/null
@@ -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_
diff --git a/audio/effect/2.0/default/AutomaticGainControlEffect.cpp b/audio/effect/2.0/default/AutomaticGainControlEffect.cpp
deleted file mode 100644
index 7e00a80..0000000
--- a/audio/effect/2.0/default/AutomaticGainControlEffect.cpp
+++ /dev/null
@@ -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
diff --git a/audio/effect/2.0/default/AutomaticGainControlEffect.h b/audio/effect/2.0/default/AutomaticGainControlEffect.h
deleted file mode 100644
index ef440d2..0000000
--- a/audio/effect/2.0/default/AutomaticGainControlEffect.h
+++ /dev/null
@@ -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
diff --git a/audio/effect/2.0/default/BassBoostEffect.cpp b/audio/effect/2.0/default/BassBoostEffect.cpp
deleted file mode 100644
index df9e892..0000000
--- a/audio/effect/2.0/default/BassBoostEffect.cpp
+++ /dev/null
@@ -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
diff --git a/audio/effect/2.0/default/BassBoostEffect.h b/audio/effect/2.0/default/BassBoostEffect.h
deleted file mode 100644
index 83179e2..0000000
--- a/audio/effect/2.0/default/BassBoostEffect.h
+++ /dev/null
@@ -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
diff --git a/audio/effect/2.0/default/Conversions.cpp b/audio/effect/2.0/default/Conversions.cpp
deleted file mode 100644
index b59752c..0000000
--- a/audio/effect/2.0/default/Conversions.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Conversions.h"
-#include "HidlUtils.h"
-
-using ::android::hardware::audio::common::V2_0::HidlUtils;
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/Conversions.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/Conversions.h b/audio/effect/2.0/default/Conversions.h
deleted file mode 100644
index 94c7f66..0000000
--- a/audio/effect/2.0/default/Conversions.h
+++ /dev/null
@@ -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_CONVERSIONS_H_
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_CONVERSIONS_H_
-
-#include <android/hardware/audio/effect/2.0/types.h>
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/Conversions.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_CONVERSIONS_H_
diff --git a/audio/effect/2.0/default/DownmixEffect.cpp b/audio/effect/2.0/default/DownmixEffect.cpp
deleted file mode 100644
index 1a51e13..0000000
--- a/audio/effect/2.0/default/DownmixEffect.cpp
+++ /dev/null
@@ -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 "Downmix_HAL"
-
-#include "DownmixEffect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/DownmixEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/DownmixEffect.h b/audio/effect/2.0/default/DownmixEffect.h
deleted file mode 100644
index 6dbbb32..0000000
--- a/audio/effect/2.0/default/DownmixEffect.h
+++ /dev/null
@@ -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_DOWNMIXEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_DOWNMIXEFFECT_H
-
-#include <android/hardware/audio/effect/2.0/IDownmixEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/DownmixEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_DOWNMIXEFFECT_H
diff --git a/audio/effect/2.0/default/Effect.cpp b/audio/effect/2.0/default/Effect.cpp
deleted file mode 100644
index e234e52..0000000
--- a/audio/effect/2.0/default/Effect.cpp
+++ /dev/null
@@ -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.
- */
-
-#include <memory.h>
-
-#define LOG_TAG "EffectHAL"
-#define ATRACE_TAG ATRACE_TAG_AUDIO
-
-#include "Conversions.h"
-#include "Effect.h"
-#include "common/all-versions/default/EffectMap.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/Effect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/Effect.h b/audio/effect/2.0/default/Effect.h
deleted file mode 100644
index a4d194d..0000000
--- a/audio/effect/2.0/default/Effect.h
+++ /dev/null
@@ -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_EFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H
-
-#include <android/hardware/audio/effect/2.0/IEffect.h>
-
-#include "AudioBufferManager.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/Effect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECT_H
diff --git a/audio/effect/2.0/default/EffectsFactory.cpp b/audio/effect/2.0/default/EffectsFactory.cpp
deleted file mode 100644
index a48a85f..0000000
--- a/audio/effect/2.0/default/EffectsFactory.cpp
+++ /dev/null
@@ -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.
- */
-
-#define LOG_TAG "EffectFactoryHAL"
-#include "EffectsFactory.h"
-#include "AcousticEchoCancelerEffect.h"
-#include "AutomaticGainControlEffect.h"
-#include "BassBoostEffect.h"
-#include "Conversions.h"
-#include "DownmixEffect.h"
-#include "Effect.h"
-#include "EnvironmentalReverbEffect.h"
-#include "EqualizerEffect.h"
-#include "HidlUtils.h"
-#include "LoudnessEnhancerEffect.h"
-#include "NoiseSuppressionEffect.h"
-#include "PresetReverbEffect.h"
-#include "VirtualizerEffect.h"
-#include "VisualizerEffect.h"
-#include "common/all-versions/default/EffectMap.h"
-
-using ::android::hardware::audio::common::V2_0::HidlUtils;
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/EffectsFactory.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/EffectsFactory.h b/audio/effect/2.0/default/EffectsFactory.h
deleted file mode 100644
index f1bfbcf..0000000
--- a/audio/effect/2.0/default/EffectsFactory.h
+++ /dev/null
@@ -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_EFFECT_V2_0_EFFECTSFACTORY_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H
-
-#include <system/audio_effect.h>
-
-#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
-
-#include <hidl/MQDescriptor.h>
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/EffectsFactory.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EFFECTSFACTORY_H
diff --git a/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp b/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp
deleted file mode 100644
index 017dd1f..0000000
--- a/audio/effect/2.0/default/EnvironmentalReverbEffect.cpp
+++ /dev/null
@@ -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 "EnvReverb_HAL"
-#include <android/log.h>
-
-#include "EnvironmentalReverbEffect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/EnvironmentalReverbEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/EnvironmentalReverbEffect.h b/audio/effect/2.0/default/EnvironmentalReverbEffect.h
deleted file mode 100644
index d93a53f..0000000
--- a/audio/effect/2.0/default/EnvironmentalReverbEffect.h
+++ /dev/null
@@ -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_ENVIRONMENTALREVERBEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ENVIRONMENTALREVERBEFFECT_H
-
-#include <system/audio_effects/effect_environmentalreverb.h>
-
-#include <android/hardware/audio/effect/2.0/IEnvironmentalReverbEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/EnvironmentalReverbEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ENVIRONMENTALREVERBEFFECT_H
diff --git a/audio/effect/2.0/default/EqualizerEffect.cpp b/audio/effect/2.0/default/EqualizerEffect.cpp
deleted file mode 100644
index d6e056c..0000000
--- a/audio/effect/2.0/default/EqualizerEffect.cpp
+++ /dev/null
@@ -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 "Equalizer_HAL"
-
-#include "EqualizerEffect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/EqualizerEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/EqualizerEffect.h b/audio/effect/2.0/default/EqualizerEffect.h
deleted file mode 100644
index 54cdd50..0000000
--- a/audio/effect/2.0/default/EqualizerEffect.h
+++ /dev/null
@@ -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_EQUALIZEREFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EQUALIZEREFFECT_H
-
-#include <android/hardware/audio/effect/2.0/IEqualizerEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/EqualizerEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_EQUALIZEREFFECT_H
diff --git a/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp b/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp
deleted file mode 100644
index 2dca0f4..0000000
--- a/audio/effect/2.0/default/LoudnessEnhancerEffect.cpp
+++ /dev/null
@@ -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 "LoudnessEnhancer_HAL"
-
-#include "LoudnessEnhancerEffect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/LoudnessEnhancerEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/LoudnessEnhancerEffect.h b/audio/effect/2.0/default/LoudnessEnhancerEffect.h
deleted file mode 100644
index 992e238..0000000
--- a/audio/effect/2.0/default/LoudnessEnhancerEffect.h
+++ /dev/null
@@ -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_LOUDNESSENHANCEREFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_LOUDNESSENHANCEREFFECT_H
-
-#include <android/hardware/audio/effect/2.0/ILoudnessEnhancerEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/LoudnessEnhancerEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_LOUDNESSENHANCEREFFECT_H
diff --git a/audio/effect/2.0/default/NoiseSuppressionEffect.cpp b/audio/effect/2.0/default/NoiseSuppressionEffect.cpp
deleted file mode 100644
index 089e811..0000000
--- a/audio/effect/2.0/default/NoiseSuppressionEffect.cpp
+++ /dev/null
@@ -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 "NS_Effect_HAL"
-
-#include "NoiseSuppressionEffect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/NoiseSuppressionEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/NoiseSuppressionEffect.h b/audio/effect/2.0/default/NoiseSuppressionEffect.h
deleted file mode 100644
index 0eee4b5..0000000
--- a/audio/effect/2.0/default/NoiseSuppressionEffect.h
+++ /dev/null
@@ -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_NOISESUPPRESSIONEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_NOISESUPPRESSIONEFFECT_H
-
-#include <android/hardware/audio/effect/2.0/INoiseSuppressionEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/NoiseSuppressionEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_NOISESUPPRESSIONEFFECT_H
diff --git a/audio/effect/2.0/default/OWNERS b/audio/effect/2.0/default/OWNERS
deleted file mode 100644
index 6fdc97c..0000000
--- a/audio/effect/2.0/default/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-elaurent@google.com
-krocard@google.com
-mnaganov@google.com
diff --git a/audio/effect/2.0/default/PresetReverbEffect.cpp b/audio/effect/2.0/default/PresetReverbEffect.cpp
deleted file mode 100644
index 0648f6a..0000000
--- a/audio/effect/2.0/default/PresetReverbEffect.cpp
+++ /dev/null
@@ -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 "PresetReverb_HAL"
-
-#include "PresetReverbEffect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/PresetReverbEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/PresetReverbEffect.h b/audio/effect/2.0/default/PresetReverbEffect.h
deleted file mode 100644
index 1ea1626..0000000
--- a/audio/effect/2.0/default/PresetReverbEffect.h
+++ /dev/null
@@ -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_PRESETREVERBEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_PRESETREVERBEFFECT_H
-
-#include <android/hardware/audio/effect/2.0/IPresetReverbEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/PresetReverbEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_PRESETREVERBEFFECT_H
diff --git a/audio/effect/2.0/default/VirtualizerEffect.cpp b/audio/effect/2.0/default/VirtualizerEffect.cpp
deleted file mode 100644
index 63d3eb9..0000000
--- a/audio/effect/2.0/default/VirtualizerEffect.cpp
+++ /dev/null
@@ -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 "Virtualizer_HAL"
-
-#include "VirtualizerEffect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/VirtualizerEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/VirtualizerEffect.h b/audio/effect/2.0/default/VirtualizerEffect.h
deleted file mode 100644
index 04f93c4..0000000
--- a/audio/effect/2.0/default/VirtualizerEffect.h
+++ /dev/null
@@ -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_VIRTUALIZEREFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VIRTUALIZEREFFECT_H
-
-#include <android/hardware/audio/effect/2.0/IVirtualizerEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/VirtualizerEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VIRTUALIZEREFFECT_H
diff --git a/audio/effect/2.0/default/VisualizerEffect.cpp b/audio/effect/2.0/default/VisualizerEffect.cpp
deleted file mode 100644
index 5235524..0000000
--- a/audio/effect/2.0/default/VisualizerEffect.cpp
+++ /dev/null
@@ -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 "Visualizer_HAL"
-
-#include "VisualizerEffect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/VisualizerEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/2.0/default/VisualizerEffect.h b/audio/effect/2.0/default/VisualizerEffect.h
deleted file mode 100644
index 940f15d..0000000
--- a/audio/effect/2.0/default/VisualizerEffect.h
+++ /dev/null
@@ -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_VISUALIZEREFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H
-
-#include <android/hardware/audio/effect/2.0/IVisualizerEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V2_0
-#include <effect/all-versions/default/VisualizerEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_VISUALIZEREFFECT_H
diff --git a/audio/effect/2.0/vts/OWNERS b/audio/effect/2.0/vts/OWNERS
deleted file mode 100644
index 8711a9f..0000000
--- a/audio/effect/2.0/vts/OWNERS
+++ /dev/null
@@ -1,5 +0,0 @@
-elaurent@google.com
-krocard@google.com
-mnaganov@google.com
-yim@google.com
-zhuoyao@google.com
\ No newline at end of file
diff --git a/audio/effect/2.0/vts/functional/Android.bp b/audio/effect/2.0/vts/functional/Android.bp
deleted file mode 100644
index 51d2e11..0000000
--- a/audio/effect/2.0/vts/functional/Android.bp
+++ /dev/null
@@ -1,35 +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_test {
- name: "VtsHalAudioEffectV2_0TargetTest",
- defaults: ["VtsHalTargetTestDefaults"],
- srcs: [
- "VtsHalAudioEffectV2_0TargetTest.cpp",
- "ValidateAudioEffectsConfiguration.cpp"
- ],
- static_libs: [
- "android.hardware.audio.common.test.utility",
- "android.hardware.audio.common@2.0",
- "android.hardware.audio.effect@2.0",
- "android.hidl.allocator@1.0",
- "android.hidl.memory@1.0",
- "libeffectsconfig",
- "libicuuc",
- "libicuuc_stubdata",
- "libxml2",
- ],
-}
diff --git a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp b/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
deleted file mode 100644
index bf080d3..0000000
--- a/audio/effect/2.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
+++ /dev/null
@@ -1,32 +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 <iterator>
-
-#include <media/EffectsConfig.h>
-
-#include "utility/ValidateXml.h"
-
-TEST(CheckConfig, audioEffectsConfigurationValidation) {
- RecordProperty("description",
- "Verify that the effects configuration file is valid according to the schema");
- using namespace android::effectsConfig;
-
- std::vector<const char*> locations(std::begin(DEFAULT_LOCATIONS), std::end(DEFAULT_LOCATIONS));
- EXPECT_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations,
- "/data/local/tmp/audio_effects_conf_V2_0.xsd");
-}
diff --git a/audio/effect/2.0/vts/functional/VtsHalAudioEffectV2_0TargetTest.cpp b/audio/effect/2.0/vts/functional/VtsHalAudioEffectV2_0TargetTest.cpp
deleted file mode 100644
index c90c4fa..0000000
--- a/audio/effect/2.0/vts/functional/VtsHalAudioEffectV2_0TargetTest.cpp
+++ /dev/null
@@ -1,849 +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 "AudioEffectHidlHalTest"
-#include <android-base/logging.h>
-#include <system/audio.h>
-
-#include <android/hardware/audio/effect/2.0/IEffect.h>
-#include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
-#include <android/hardware/audio/effect/2.0/IEqualizerEffect.h>
-#include <android/hardware/audio/effect/2.0/ILoudnessEnhancerEffect.h>
-#include <android/hardware/audio/effect/2.0/types.h>
-#include <android/hidl/allocator/1.0/IAllocator.h>
-#include <android/hidl/memory/1.0/IMemory.h>
-
-#include <VtsHalHidlTargetTestBase.h>
-#include <VtsHalHidlTargetTestEnvBase.h>
-
-using android::hardware::audio::common::V2_0::AudioDevice;
-using android::hardware::audio::common::V2_0::AudioHandleConsts;
-using android::hardware::audio::common::V2_0::AudioMode;
-using android::hardware::audio::common::V2_0::AudioSource;
-using android::hardware::audio::common::V2_0::Uuid;
-using android::hardware::audio::effect::V2_0::AudioBuffer;
-using android::hardware::audio::effect::V2_0::EffectAuxChannelsConfig;
-using android::hardware::audio::effect::V2_0::EffectBufferConfig;
-using android::hardware::audio::effect::V2_0::EffectConfig;
-using android::hardware::audio::effect::V2_0::EffectDescriptor;
-using android::hardware::audio::effect::V2_0::EffectOffloadParameter;
-using android::hardware::audio::effect::V2_0::IEffect;
-using android::hardware::audio::effect::V2_0::IEffectsFactory;
-using android::hardware::audio::effect::V2_0::IEqualizerEffect;
-using android::hardware::audio::effect::V2_0::ILoudnessEnhancerEffect;
-using android::hardware::audio::effect::V2_0::Result;
-using android::hardware::MQDescriptorSync;
-using android::hardware::Return;
-using android::hardware::Void;
-using android::hardware::hidl_handle;
-using android::hardware::hidl_memory;
-using android::hardware::hidl_string;
-using android::hardware::hidl_vec;
-using android::hidl::allocator::V1_0::IAllocator;
-using android::hidl::memory::V1_0::IMemory;
-using android::sp;
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
-#endif
-
-// Test environment for Audio Effects Factory HIDL HAL.
-class AudioEffectsFactoryHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
- public:
- // get the test environment singleton
- static AudioEffectsFactoryHidlEnvironment* Instance() {
- static AudioEffectsFactoryHidlEnvironment* instance =
- new AudioEffectsFactoryHidlEnvironment;
- return instance;
- }
-
- virtual void registerTestServices() override { registerTestService<IEffectsFactory>(); }
-};
-
-// The main test class for Audio Effects Factory HIDL HAL.
-class AudioEffectsFactoryHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- public:
- void SetUp() override {
- effectsFactory = ::testing::VtsHalHidlTargetTestBase::getService<IEffectsFactory>(
- AudioEffectsFactoryHidlEnvironment::Instance()->getServiceName<IEffectsFactory>());
- ASSERT_NE(effectsFactory, nullptr);
- }
-
- void TearDown() override { effectsFactory.clear(); }
-
- protected:
- static void description(const std::string& description) {
- RecordProperty("description", description);
- }
-
- sp<IEffectsFactory> effectsFactory;
-};
-
-TEST_F(AudioEffectsFactoryHidlTest, EnumerateEffects) {
- description("Verify that EnumerateEffects returns at least one effect");
- Result retval = Result::NOT_INITIALIZED;
- size_t effectCount = 0;
- Return<void> ret = effectsFactory->getAllDescriptors(
- [&](Result r, const hidl_vec<EffectDescriptor>& result) {
- retval = r;
- effectCount = result.size();
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_GT(effectCount, 0u);
-}
-
-TEST_F(AudioEffectsFactoryHidlTest, CreateEffect) {
- description("Verify that an effect can be created via CreateEffect");
- bool gotEffect = false;
- Uuid effectUuid;
- Return<void> ret = effectsFactory->getAllDescriptors(
- [&](Result r, const hidl_vec<EffectDescriptor>& result) {
- if (r == Result::OK && result.size() > 0) {
- gotEffect = true;
- effectUuid = result[0].uuid;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_TRUE(gotEffect);
- Result retval = Result::NOT_INITIALIZED;
- sp<IEffect> effect;
- ret = effectsFactory->createEffect(
- effectUuid, 1 /*session*/, 1 /*ioHandle*/,
- [&](Result r, const sp<IEffect>& result, uint64_t /*effectId*/) {
- retval = r;
- if (r == Result::OK) {
- effect = result;
- }
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_NE(nullptr, effect.get());
-}
-
-TEST_F(AudioEffectsFactoryHidlTest, GetDescriptor) {
- description(
- "Verify that effects factory can provide an effect descriptor via "
- "GetDescriptor");
- hidl_vec<EffectDescriptor> allDescriptors;
- Return<void> ret = effectsFactory->getAllDescriptors(
- [&](Result r, const hidl_vec<EffectDescriptor>& result) {
- if (r == Result::OK) {
- allDescriptors = result;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_GT(allDescriptors.size(), 0u);
- for (size_t i = 0; i < allDescriptors.size(); ++i) {
- ret = effectsFactory->getDescriptor(
- allDescriptors[i].uuid, [&](Result r, const EffectDescriptor& result) {
- EXPECT_EQ(r, Result::OK);
- EXPECT_EQ(result, allDescriptors[i]);
- });
- }
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectsFactoryHidlTest, DebugDumpInvalidArgument) {
- description("Verify that debugDump doesn't crash on invalid arguments");
- Return<void> ret = effectsFactory->debugDump(hidl_handle());
- ASSERT_TRUE(ret.isOk());
-}
-
-// Equalizer effect is required by CDD, but only the type is fixed.
-// This is the same UUID as AudioEffect.EFFECT_TYPE_EQUALIZER in Java.
-static const Uuid EQUALIZER_EFFECT_TYPE = {
- 0x0bed4300, 0xddd6, 0x11db, 0x8f34,
- std::array<uint8_t, 6>{{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}};
-// Loudness Enhancer effect is required by CDD, but only the type is fixed.
-// This is the same UUID as AudioEffect.EFFECT_TYPE_LOUDNESS_ENHANCER in Java.
-static const Uuid LOUDNESS_ENHANCER_EFFECT_TYPE = {
- 0xfe3199be, 0xaed0, 0x413f, 0x87bb,
- std::array<uint8_t, 6>{{0x11, 0x26, 0x0e, 0xb6, 0x3c, 0xf1}}};
-
-// The main test class for Audio Effect HIDL HAL.
-class AudioEffectHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- public:
- void SetUp() override {
- effectsFactory =
- ::testing::VtsHalHidlTargetTestBase::getService<IEffectsFactory>();
- ASSERT_NE(nullptr, effectsFactory.get());
-
- findAndCreateEffect(getEffectType());
- ASSERT_NE(nullptr, effect.get());
-
- Return<Result> ret = effect->init();
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, ret);
- }
-
- void TearDown() override {
- effect.clear();
- effectsFactory.clear();
- }
-
- protected:
- static void description(const std::string& description) {
- RecordProperty("description", description);
- }
-
- virtual Uuid getEffectType() { return EQUALIZER_EFFECT_TYPE; }
-
- void findAndCreateEffect(const Uuid& type);
- void findEffectInstance(const Uuid& type, Uuid* uuid);
- void getChannelCount(uint32_t* channelCount);
-
- sp<IEffectsFactory> effectsFactory;
- sp<IEffect> effect;
-};
-
-void AudioEffectHidlTest::findAndCreateEffect(const Uuid& type) {
- Uuid effectUuid;
- findEffectInstance(type, &effectUuid);
- Return<void> ret = effectsFactory->createEffect(
- effectUuid, 1 /*session*/, 1 /*ioHandle*/,
- [&](Result r, const sp<IEffect>& result, uint64_t /*effectId*/) {
- if (r == Result::OK) {
- effect = result;
- }
- });
- ASSERT_TRUE(ret.isOk());
-}
-
-void AudioEffectHidlTest::findEffectInstance(const Uuid& type, Uuid* uuid) {
- bool effectFound = false;
- Return<void> ret = effectsFactory->getAllDescriptors(
- [&](Result r, const hidl_vec<EffectDescriptor>& result) {
- if (r == Result::OK) {
- for (const auto& desc : result) {
- if (desc.type == type) {
- effectFound = true;
- *uuid = desc.uuid;
- break;
- }
- }
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_TRUE(effectFound);
-}
-
-void AudioEffectHidlTest::getChannelCount(uint32_t* channelCount) {
- Result retval;
- EffectConfig currentConfig;
- Return<void> ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
- retval = r;
- if (r == Result::OK) {
- currentConfig = conf;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
- ASSERT_TRUE(audio_channel_mask_is_valid(
- static_cast<audio_channel_mask_t>(currentConfig.outputCfg.channels)));
- *channelCount = audio_channel_count_from_out_mask(
- static_cast<audio_channel_mask_t>(currentConfig.outputCfg.channels));
-}
-
-TEST_F(AudioEffectHidlTest, Close) {
- description("Verify that an effect can be closed");
- Return<Result> ret = effect->close();
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, GetDescriptor) {
- description(
- "Verify that an effect can return its own descriptor via GetDescriptor");
- Result retval = Result::NOT_INITIALIZED;
- Uuid actualType;
- Return<void> ret =
- effect->getDescriptor([&](Result r, const EffectDescriptor& desc) {
- retval = r;
- if (r == Result::OK) {
- actualType = desc.type;
- }
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(getEffectType(), actualType);
-}
-
-TEST_F(AudioEffectHidlTest, GetSetConfig) {
- description(
- "Verify that it is possible to manipulate effect config via Get / "
- "SetConfig");
- Result retval = Result::NOT_INITIALIZED;
- EffectConfig currentConfig;
- Return<void> ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
- retval = r;
- if (r == Result::OK) {
- currentConfig = conf;
- }
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- Return<Result> ret2 = effect->setConfig(currentConfig, nullptr, nullptr);
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, ret2);
-}
-
-TEST_F(AudioEffectHidlTest, GetConfigReverse) {
- description("Verify that GetConfigReverse does not crash");
- Return<void> ret =
- effect->getConfigReverse([&](Result, const EffectConfig&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetSupportedAuxChannelsConfigs) {
- description("Verify that GetSupportedAuxChannelsConfigs does not crash");
- Return<void> ret = effect->getSupportedAuxChannelsConfigs(
- 0, [&](Result, const hidl_vec<EffectAuxChannelsConfig>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetAuxChannelsConfig) {
- description("Verify that GetAuxChannelsConfig does not crash");
- Return<void> ret = effect->getAuxChannelsConfig(
- [&](Result, const EffectAuxChannelsConfig&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetAuxChannelsConfig) {
- description("Verify that SetAuxChannelsConfig does not crash");
- Return<Result> ret = effect->setAuxChannelsConfig(EffectAuxChannelsConfig());
- EXPECT_TRUE(ret.isOk());
-}
-
-// Not generated automatically because AudioBuffer contains
-// instances of hidl_memory which can't be compared properly
-// in general case due to presence of handles.
-//
-// However, in this particular case, handles must not present
-// thus comparison is possible.
-//
-// operator== must be defined in the same namespace as the structures.
-namespace android {
-namespace hardware {
-namespace audio {
-namespace effect {
-namespace V2_0 {
-inline bool operator==(const AudioBuffer& lhs, const AudioBuffer& rhs) {
- return lhs.id == rhs.id && lhs.frameCount == rhs.frameCount &&
- lhs.data.handle() == nullptr && rhs.data.handle() == nullptr;
-}
-
-inline bool operator==(const EffectBufferConfig& lhs,
- const EffectBufferConfig& rhs) {
- return lhs.buffer == rhs.buffer && lhs.samplingRateHz == rhs.samplingRateHz &&
- lhs.channels == rhs.channels && lhs.format == rhs.format &&
- lhs.accessMode == rhs.accessMode && lhs.mask == rhs.mask;
-}
-
-inline bool operator==(const EffectConfig& lhs, const EffectConfig& rhs) {
- return lhs.inputCfg == rhs.inputCfg && lhs.outputCfg == rhs.outputCfg;
-}
-} // namespace V2_0
-} // namespace effect
-} // namespace audio
-} // namespace hardware
-} // namespace android
-
-TEST_F(AudioEffectHidlTest, Reset) {
- description("Verify that Reset preserves effect configuration");
- Result retval = Result::NOT_INITIALIZED;
- EffectConfig originalConfig;
- Return<void> ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
- retval = r;
- if (r == Result::OK) {
- originalConfig = conf;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
- Return<Result> ret2 = effect->reset();
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, ret2);
- EffectConfig configAfterReset;
- ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
- retval = r;
- if (r == Result::OK) {
- configAfterReset = conf;
- }
- });
- EXPECT_EQ(originalConfig, configAfterReset);
-}
-
-TEST_F(AudioEffectHidlTest, DisableEnableDisable) {
- description("Verify Disable -> Enable -> Disable sequence for an effect");
- Return<Result> ret = effect->disable();
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::INVALID_ARGUMENTS, ret);
- ret = effect->enable();
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- ret = effect->disable();
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, SetDevice) {
- description("Verify that SetDevice works for an output chain effect");
- Return<Result> ret = effect->setDevice(AudioDevice::OUT_SPEAKER);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, SetAndGetVolume) {
- description("Verify that SetAndGetVolume method works for an effect");
- uint32_t channelCount;
- getChannelCount(&channelCount);
- hidl_vec<uint32_t> volumes;
- volumes.resize(channelCount);
- for (uint32_t i = 0; i < channelCount; ++i) {
- volumes[i] = 0;
- }
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = effect->setAndGetVolume(
- volumes, [&](Result r, const hidl_vec<uint32_t>&) { retval = r; });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
-}
-
-TEST_F(AudioEffectHidlTest, VolumeChangeNotification) {
- description("Verify that effect accepts VolumeChangeNotification");
- uint32_t channelCount;
- getChannelCount(&channelCount);
- hidl_vec<uint32_t> volumes;
- volumes.resize(channelCount);
- for (uint32_t i = 0; i < channelCount; ++i) {
- volumes[i] = 0;
- }
- Return<Result> ret = effect->volumeChangeNotification(volumes);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, SetAudioMode) {
- description("Verify that SetAudioMode works for an effect");
- Return<Result> ret = effect->setAudioMode(AudioMode::NORMAL);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, SetConfigReverse) {
- description("Verify that SetConfigReverse does not crash");
- Return<Result> ret =
- effect->setConfigReverse(EffectConfig(), nullptr, nullptr);
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetInputDevice) {
- description("Verify that SetInputDevice does not crash");
- Return<Result> ret = effect->setInputDevice(AudioDevice::IN_BUILTIN_MIC);
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetAudioSource) {
- description("Verify that SetAudioSource does not crash");
- Return<Result> ret = effect->setAudioSource(AudioSource::MIC);
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, Offload) {
- description("Verify that calling Offload method does not crash");
- EffectOffloadParameter offloadParam;
- offloadParam.isOffload = false;
- offloadParam.ioHandle =
- static_cast<int>(AudioHandleConsts::AUDIO_IO_HANDLE_NONE);
- Return<Result> ret = effect->offload(offloadParam);
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, PrepareForProcessing) {
- description("Verify that PrepareForProcessing method works for an effect");
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = effect->prepareForProcessing(
- [&](Result r, const MQDescriptorSync<Result>&) { retval = r; });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
-}
-
-TEST_F(AudioEffectHidlTest, SetProcessBuffers) {
- description("Verify that SetProcessBuffers works for an effect");
- sp<IAllocator> ashmem = IAllocator::getService("ashmem");
- ASSERT_NE(nullptr, ashmem.get());
- bool success = false;
- AudioBuffer buffer;
- Return<void> ret =
- ashmem->allocate(1024, [&](bool s, const hidl_memory& memory) {
- success = s;
- if (s) {
- buffer.data = memory;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_TRUE(success);
- Return<Result> ret2 = effect->setProcessBuffers(buffer, buffer);
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, ret2);
-}
-
-TEST_F(AudioEffectHidlTest, Command) {
- description("Verify that Command does not crash");
- Return<void> ret = effect->command(0, hidl_vec<uint8_t>(), 0,
- [&](int32_t, const hidl_vec<uint8_t>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetParameter) {
- description("Verify that SetParameter does not crash");
- Return<Result> ret =
- effect->setParameter(hidl_vec<uint8_t>(), hidl_vec<uint8_t>());
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetParameter) {
- description("Verify that GetParameter does not crash");
- Return<void> ret = effect->getParameter(
- hidl_vec<uint8_t>(), 0, [&](Result, const hidl_vec<uint8_t>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetSupportedConfigsForFeature) {
- description("Verify that GetSupportedConfigsForFeature does not crash");
- Return<void> ret = effect->getSupportedConfigsForFeature(
- 0, 0, 0, [&](Result, uint32_t, const hidl_vec<uint8_t>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetCurrentConfigForFeature) {
- description("Verify that GetCurrentConfigForFeature does not crash");
- Return<void> ret = effect->getCurrentConfigForFeature(
- 0, 0, [&](Result, const hidl_vec<uint8_t>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetCurrentConfigForFeature) {
- description("Verify that SetCurrentConfigForFeature does not crash");
- Return<Result> ret =
- effect->setCurrentConfigForFeature(0, hidl_vec<uint8_t>());
- EXPECT_TRUE(ret.isOk());
-}
-
-
-// The main test class for Equalizer Audio Effect HIDL HAL.
-class EqualizerAudioEffectHidlTest : public AudioEffectHidlTest {
- public:
- void SetUp() override {
- AudioEffectHidlTest::SetUp();
- equalizer = IEqualizerEffect::castFrom(effect);
- ASSERT_NE(nullptr, equalizer.get());
- }
-
- protected:
- Uuid getEffectType() override { return EQUALIZER_EFFECT_TYPE; }
- void getNumBands(uint16_t* numBands);
- void getLevelRange(int16_t* minLevel, int16_t* maxLevel);
- void getBandFrequencyRange(uint16_t band, uint32_t* minFreq,
- uint32_t* centerFreq, uint32_t* maxFreq);
- void getPresetCount(size_t* count);
-
- sp<IEqualizerEffect> equalizer;
-};
-
-void EqualizerAudioEffectHidlTest::getNumBands(uint16_t* numBands) {
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = equalizer->getNumBands([&](Result r, uint16_t b) {
- retval = r;
- if (retval == Result::OK) {
- *numBands = b;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
-}
-
-void EqualizerAudioEffectHidlTest::getLevelRange(int16_t* minLevel,
- int16_t* maxLevel) {
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret =
- equalizer->getLevelRange([&](Result r, int16_t min, int16_t max) {
- retval = r;
- if (retval == Result::OK) {
- *minLevel = min;
- *maxLevel = max;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
-}
-
-void EqualizerAudioEffectHidlTest::getBandFrequencyRange(uint16_t band,
- uint32_t* minFreq,
- uint32_t* centerFreq,
- uint32_t* maxFreq) {
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = equalizer->getBandFrequencyRange(
- band, [&](Result r, uint32_t min, uint32_t max) {
- retval = r;
- if (retval == Result::OK) {
- *minFreq = min;
- *maxFreq = max;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
- ret = equalizer->getBandCenterFrequency(band, [&](Result r, uint32_t center) {
- retval = r;
- if (retval == Result::OK) {
- *centerFreq = center;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
-}
-
-void EqualizerAudioEffectHidlTest::getPresetCount(size_t* count) {
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = equalizer->getPresetNames(
- [&](Result r, const hidl_vec<hidl_string>& names) {
- retval = r;
- if (retval == Result::OK) {
- *count = names.size();
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetNumBands) {
- description("Verify that Equalizer effect reports at least one band");
- uint16_t numBands = 0;
- getNumBands(&numBands);
- EXPECT_GT(numBands, 0);
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetLevelRange) {
- description("Verify that Equalizer effect reports adequate band level range");
- int16_t minLevel = 0x7fff, maxLevel = 0;
- getLevelRange(&minLevel, &maxLevel);
- EXPECT_GT(maxLevel, minLevel);
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetSetBandLevel) {
- description(
- "Verify that manipulating band levels works for Equalizer effect");
- uint16_t numBands = 0;
- getNumBands(&numBands);
- ASSERT_GT(numBands, 0);
- int16_t levels[3]{0x7fff, 0, 0};
- getLevelRange(&levels[0], &levels[2]);
- ASSERT_GT(levels[2], levels[0]);
- levels[1] = (levels[2] + levels[0]) / 2;
- for (uint16_t i = 0; i < numBands; ++i) {
- for (size_t j = 0; j < ARRAY_SIZE(levels); ++j) {
- Return<Result> ret = equalizer->setBandLevel(i, levels[j]);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- Result retval = Result::NOT_INITIALIZED;
- int16_t actualLevel;
- Return<void> ret2 = equalizer->getBandLevel(i, [&](Result r, int16_t l) {
- retval = r;
- if (retval == Result::OK) {
- actualLevel = l;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(levels[j], actualLevel);
- }
- }
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetBandCenterFrequencyAndRange) {
- description(
- "Verify that Equalizer effect reports adequate band frequency range");
- uint16_t numBands = 0;
- getNumBands(&numBands);
- ASSERT_GT(numBands, 0);
- for (uint16_t i = 0; i < numBands; ++i) {
- uint32_t minFreq = 0xffffffff, centerFreq = 0xffffffff,
- maxFreq = 0xffffffff;
- getBandFrequencyRange(i, &minFreq, ¢erFreq, &maxFreq);
- // Note: NXP legacy implementation reports "1" as upper bound for last band,
- // so this check fails.
- EXPECT_GE(maxFreq, centerFreq);
- EXPECT_GE(centerFreq, minFreq);
- }
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetBandForFrequency) {
- description(
- "Verify that Equalizer effect supports GetBandForFrequency correctly");
- uint16_t numBands = 0;
- getNumBands(&numBands);
- ASSERT_GT(numBands, 0);
- for (uint16_t i = 0; i < numBands; ++i) {
- uint32_t freqs[3]{0, 0, 0};
- getBandFrequencyRange(i, &freqs[0], &freqs[1], &freqs[2]);
- // NXP legacy implementation reports "1" as upper bound for last band, some
- // of the checks fail.
- for (size_t j = 0; j < ARRAY_SIZE(freqs); ++j) {
- if (j == 0) {
- freqs[j]++;
- } // Min frequency is an open interval.
- Result retval = Result::NOT_INITIALIZED;
- uint16_t actualBand = numBands + 1;
- Return<void> ret =
- equalizer->getBandForFrequency(freqs[j], [&](Result r, uint16_t b) {
- retval = r;
- if (retval == Result::OK) {
- actualBand = b;
- }
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(i, actualBand) << "Frequency: " << freqs[j];
- }
- }
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetPresetNames) {
- description("Verify that Equalizer effect reports at least one preset");
- size_t presetCount;
- getPresetCount(&presetCount);
- EXPECT_GT(presetCount, 0u);
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetSetCurrentPreset) {
- description(
- "Verify that manipulating the current preset for Equalizer effect");
- size_t presetCount;
- getPresetCount(&presetCount);
- ASSERT_GT(presetCount, 0u);
- for (uint16_t i = 0; i < presetCount; ++i) {
- Return<Result> ret = equalizer->setCurrentPreset(i);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- Result retval = Result::NOT_INITIALIZED;
- uint16_t actualPreset = 0xffff;
- Return<void> ret2 = equalizer->getCurrentPreset([&](Result r, uint16_t p) {
- retval = r;
- if (retval == Result::OK) {
- actualPreset = p;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(i, actualPreset);
- }
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetSetAllProperties) {
- description(
- "Verify that setting band levels and presets works via Get / "
- "SetAllProperties for Equalizer effect");
- using AllProperties =
- android::hardware::audio::effect::V2_0::IEqualizerEffect::AllProperties;
- uint16_t numBands = 0;
- getNumBands(&numBands);
- ASSERT_GT(numBands, 0);
- AllProperties props;
- props.bandLevels.resize(numBands);
- for (size_t i = 0; i < numBands; ++i) {
- props.bandLevels[i] = 0;
- }
-
- AllProperties actualProps;
- Result retval = Result::NOT_INITIALIZED;
-
- // Verify setting of the band levels via properties.
- props.curPreset = -1;
- Return<Result> ret = equalizer->setAllProperties(props);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- Return<void> ret2 =
- equalizer->getAllProperties([&](Result r, AllProperties p) {
- retval = r;
- if (retval == Result::OK) {
- actualProps = p;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(props.bandLevels, actualProps.bandLevels);
-
- // Verify setting of the current preset via properties.
- props.curPreset = 0; // Assuming there is at least one preset.
- ret = equalizer->setAllProperties(props);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- ret2 = equalizer->getAllProperties([&](Result r, AllProperties p) {
- retval = r;
- if (retval == Result::OK) {
- actualProps = p;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(props.curPreset, actualProps.curPreset);
-}
-
-// The main test class for Equalizer Audio Effect HIDL HAL.
-class LoudnessEnhancerAudioEffectHidlTest : public AudioEffectHidlTest {
- public:
- void SetUp() override {
- AudioEffectHidlTest::SetUp();
- enhancer = ILoudnessEnhancerEffect::castFrom(effect);
- ASSERT_NE(nullptr, enhancer.get());
- }
-
- protected:
- Uuid getEffectType() override { return LOUDNESS_ENHANCER_EFFECT_TYPE; }
-
- sp<ILoudnessEnhancerEffect> enhancer;
-};
-
-TEST_F(LoudnessEnhancerAudioEffectHidlTest, GetSetTargetGain) {
- description(
- "Verify that manipulating the target gain works for Loudness Enhancer "
- "effect");
- const int32_t gain = 100;
- Return<Result> ret = enhancer->setTargetGain(gain);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- int32_t actualGain = 0;
- Result retval;
- Return<void> ret2 = enhancer->getTargetGain([&](Result r, int32_t g) {
- retval = r;
- if (retval == Result::OK) {
- actualGain = g;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(gain, actualGain);
-}
-
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(AudioEffectsFactoryHidlEnvironment::Instance());
- ::testing::InitGoogleTest(&argc, argv);
- AudioEffectsFactoryHidlEnvironment::Instance()->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
- return status;
-}
diff --git a/audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd b/audio/effect/2.0/xml/audio_effects_conf.xsd
similarity index 100%
rename from audio/effect/2.0/xml/audio_effects_conf_V2_0.xsd
rename to audio/effect/2.0/xml/audio_effects_conf.xsd
diff --git a/audio/effect/4.0/default/AcousticEchoCancelerEffect.cpp b/audio/effect/4.0/default/AcousticEchoCancelerEffect.cpp
deleted file mode 100644
index 242740e..0000000
--- a/audio/effect/4.0/default/AcousticEchoCancelerEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "AEC_Effect_HAL"
-
-#include "AcousticEchoCancelerEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/AcousticEchoCancelerEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/AcousticEchoCancelerEffect.h b/audio/effect/4.0/default/AcousticEchoCancelerEffect.h
deleted file mode 100644
index 0ac0a1e..0000000
--- a/audio/effect/4.0/default/AcousticEchoCancelerEffect.h
+++ /dev/null
@@ -1,28 +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_V4_0_ACOUSTICECHOCANCELEREFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ACOUSTICECHOCANCELEREFFECT_H
-
-#include <android/hardware/audio/effect/4.0/IAcousticEchoCancelerEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/AcousticEchoCancelerEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ACOUSTICECHOCANCELEREFFECT_H
diff --git a/audio/effect/4.0/default/Android.bp b/audio/effect/4.0/default/Android.bp
deleted file mode 100644
index dcb2269..0000000
--- a/audio/effect/4.0/default/Android.bp
+++ /dev/null
@@ -1,50 +0,0 @@
-cc_library_shared {
- name: "android.hardware.audio.effect@4.0-impl",
- defaults: ["hidl_defaults"],
- vendor: true,
- relative_install_path: "hw",
- srcs: [
- "AcousticEchoCancelerEffect.cpp",
- "AudioBufferManager.cpp",
- "AutomaticGainControlEffect.cpp",
- "BassBoostEffect.cpp",
- "Conversions.cpp",
- "DownmixEffect.cpp",
- "Effect.cpp",
- "EffectsFactory.cpp",
- "EnvironmentalReverbEffect.cpp",
- "EqualizerEffect.cpp",
- "LoudnessEnhancerEffect.cpp",
- "NoiseSuppressionEffect.cpp",
- "PresetReverbEffect.cpp",
- "VirtualizerEffect.cpp",
- "VisualizerEffect.cpp",
- ],
-
- shared_libs: [
- "libbase",
- "libcutils",
- "libeffects",
- "libfmq",
- "libhidlbase",
- "libhidlmemory",
- "libhidltransport",
- "liblog",
- "libutils",
- "android.hardware.audio.common-util",
- "android.hardware.audio.common@4.0",
- "android.hardware.audio.common@4.0-util",
- "android.hardware.audio.effect@4.0",
- "android.hidl.memory@1.0",
- ],
-
- header_libs: [
- "android.hardware.audio.common.util@all-versions",
- "android.hardware.audio.effect@all-versions-impl",
- "libaudio_system_headers",
- "libaudioclient_headers",
- "libeffects_headers",
- "libhardware_headers",
- "libmedia_headers",
- ],
-}
diff --git a/audio/effect/4.0/default/AudioBufferManager.cpp b/audio/effect/4.0/default/AudioBufferManager.cpp
deleted file mode 100644
index 2d75f3f..0000000
--- a/audio/effect/4.0/default/AudioBufferManager.cpp
+++ /dev/null
@@ -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 "AudioBufferManager.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/AudioBufferManager.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/AudioBufferManager.h b/audio/effect/4.0/default/AudioBufferManager.h
deleted file mode 100644
index 1f151e6..0000000
--- a/audio/effect/4.0/default/AudioBufferManager.h
+++ /dev/null
@@ -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_EFFECT_V4_0_AUDIO_BUFFER_MANAGER_H_
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUDIO_BUFFER_MANAGER_H_
-
-#include <android/hardware/audio/effect/4.0/types.h>
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/AudioBufferManager.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUDIO_BUFFER_MANAGER_H_
diff --git a/audio/effect/4.0/default/AutomaticGainControlEffect.cpp b/audio/effect/4.0/default/AutomaticGainControlEffect.cpp
deleted file mode 100644
index 9d21c8a..0000000
--- a/audio/effect/4.0/default/AutomaticGainControlEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "AGC_Effect_HAL"
-
-#include "AutomaticGainControlEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/AutomaticGainControlEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/AutomaticGainControlEffect.h b/audio/effect/4.0/default/AutomaticGainControlEffect.h
deleted file mode 100644
index 7f12007..0000000
--- a/audio/effect/4.0/default/AutomaticGainControlEffect.h
+++ /dev/null
@@ -1,28 +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_V4_0_AUTOMATICGAINCONTROLEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUTOMATICGAINCONTROLEFFECT_H
-
-#include <android/hardware/audio/effect/4.0/IAutomaticGainControlEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/AutomaticGainControlEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_AUTOMATICGAINCONTROLEFFECT_H
diff --git a/audio/effect/4.0/default/BassBoostEffect.cpp b/audio/effect/4.0/default/BassBoostEffect.cpp
deleted file mode 100644
index 74a626b..0000000
--- a/audio/effect/4.0/default/BassBoostEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "BassBoost_HAL"
-
-#include "BassBoostEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/BassBoostEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/BassBoostEffect.h b/audio/effect/4.0/default/BassBoostEffect.h
deleted file mode 100644
index 206a75f..0000000
--- a/audio/effect/4.0/default/BassBoostEffect.h
+++ /dev/null
@@ -1,30 +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_V4_0_BASSBOOSTEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_BASSBOOSTEFFECT_H
-
-#include <android/hardware/audio/effect/4.0/IBassBoostEffect.h>
-
-#include <hidl/MQDescriptor.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/BassBoostEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_BASSBOOSTEFFECT_H
diff --git a/audio/effect/4.0/default/Conversions.cpp b/audio/effect/4.0/default/Conversions.cpp
deleted file mode 100644
index 91285ae..0000000
--- a/audio/effect/4.0/default/Conversions.cpp
+++ /dev/null
@@ -1,24 +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 "Conversions.h"
-#include "HidlUtils.h"
-
-using ::android::hardware::audio::common::V4_0::HidlUtils;
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/Conversions.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/Conversions.h b/audio/effect/4.0/default/Conversions.h
deleted file mode 100644
index 50e380f..0000000
--- a/audio/effect/4.0/default/Conversions.h
+++ /dev/null
@@ -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_EFFECT_V4_0_CONVERSIONS_H_
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_CONVERSIONS_H_
-
-#include <android/hardware/audio/effect/4.0/types.h>
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/Conversions.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_CONVERSIONS_H_
diff --git a/audio/effect/4.0/default/DownmixEffect.cpp b/audio/effect/4.0/default/DownmixEffect.cpp
deleted file mode 100644
index 07fcab2..0000000
--- a/audio/effect/4.0/default/DownmixEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "Downmix_HAL"
-
-#include "DownmixEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/DownmixEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/DownmixEffect.h b/audio/effect/4.0/default/DownmixEffect.h
deleted file mode 100644
index 5ae820b..0000000
--- a/audio/effect/4.0/default/DownmixEffect.h
+++ /dev/null
@@ -1,28 +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_V4_0_DOWNMIXEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_DOWNMIXEFFECT_H
-
-#include <android/hardware/audio/effect/4.0/IDownmixEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/DownmixEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_DOWNMIXEFFECT_H
diff --git a/audio/effect/4.0/default/Effect.cpp b/audio/effect/4.0/default/Effect.cpp
deleted file mode 100644
index 707044b..0000000
--- a/audio/effect/4.0/default/Effect.cpp
+++ /dev/null
@@ -1,28 +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 <memory.h>
-
-#define LOG_TAG "EffectHAL"
-#define ATRACE_TAG ATRACE_TAG_AUDIO
-
-#include "Conversions.h"
-#include "Effect.h"
-#include "common/all-versions/default/EffectMap.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/Effect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/Effect.h b/audio/effect/4.0/default/Effect.h
deleted file mode 100644
index 9ca79c4..0000000
--- a/audio/effect/4.0/default/Effect.h
+++ /dev/null
@@ -1,28 +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_V4_0_EFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECT_H
-
-#include <android/hardware/audio/effect/4.0/IEffect.h>
-
-#include "AudioBufferManager.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/Effect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECT_H
diff --git a/audio/effect/4.0/default/EffectsFactory.cpp b/audio/effect/4.0/default/EffectsFactory.cpp
deleted file mode 100644
index ee0413d..0000000
--- a/audio/effect/4.0/default/EffectsFactory.cpp
+++ /dev/null
@@ -1,39 +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.
- */
-
-#define LOG_TAG "EffectFactoryHAL"
-#include "EffectsFactory.h"
-#include "AcousticEchoCancelerEffect.h"
-#include "AutomaticGainControlEffect.h"
-#include "BassBoostEffect.h"
-#include "Conversions.h"
-#include "DownmixEffect.h"
-#include "Effect.h"
-#include "EnvironmentalReverbEffect.h"
-#include "EqualizerEffect.h"
-#include "HidlUtils.h"
-#include "LoudnessEnhancerEffect.h"
-#include "NoiseSuppressionEffect.h"
-#include "PresetReverbEffect.h"
-#include "VirtualizerEffect.h"
-#include "VisualizerEffect.h"
-#include "common/all-versions/default/EffectMap.h"
-
-using ::android::hardware::audio::common::V4_0::HidlUtils;
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/EffectsFactory.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/EffectsFactory.h b/audio/effect/4.0/default/EffectsFactory.h
deleted file mode 100644
index 48e4b4c..0000000
--- a/audio/effect/4.0/default/EffectsFactory.h
+++ /dev/null
@@ -1,29 +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_V4_0_EFFECTSFACTORY_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECTSFACTORY_H
-
-#include <system/audio_effect.h>
-
-#include <android/hardware/audio/effect/4.0/IEffectsFactory.h>
-
-#include <hidl/MQDescriptor.h>
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/EffectsFactory.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EFFECTSFACTORY_H
diff --git a/audio/effect/4.0/default/EnvironmentalReverbEffect.cpp b/audio/effect/4.0/default/EnvironmentalReverbEffect.cpp
deleted file mode 100644
index cc3102d..0000000
--- a/audio/effect/4.0/default/EnvironmentalReverbEffect.cpp
+++ /dev/null
@@ -1,24 +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.
- */
-
-#define LOG_TAG "EnvReverb_HAL"
-#include <android/log.h>
-
-#include "EnvironmentalReverbEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/EnvironmentalReverbEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/EnvironmentalReverbEffect.h b/audio/effect/4.0/default/EnvironmentalReverbEffect.h
deleted file mode 100644
index c0fb25c..0000000
--- a/audio/effect/4.0/default/EnvironmentalReverbEffect.h
+++ /dev/null
@@ -1,30 +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_V4_0_ENVIRONMENTALREVERBEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ENVIRONMENTALREVERBEFFECT_H
-
-#include <system/audio_effects/effect_environmentalreverb.h>
-
-#include <android/hardware/audio/effect/4.0/IEnvironmentalReverbEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/EnvironmentalReverbEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_ENVIRONMENTALREVERBEFFECT_H
diff --git a/audio/effect/4.0/default/EqualizerEffect.cpp b/audio/effect/4.0/default/EqualizerEffect.cpp
deleted file mode 100644
index d0a40bc..0000000
--- a/audio/effect/4.0/default/EqualizerEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "Equalizer_HAL"
-
-#include "EqualizerEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/EqualizerEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/EqualizerEffect.h b/audio/effect/4.0/default/EqualizerEffect.h
deleted file mode 100644
index 7c9463b..0000000
--- a/audio/effect/4.0/default/EqualizerEffect.h
+++ /dev/null
@@ -1,28 +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_V4_0_EQUALIZEREFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EQUALIZEREFFECT_H
-
-#include <android/hardware/audio/effect/4.0/IEqualizerEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/EqualizerEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_EQUALIZEREFFECT_H
diff --git a/audio/effect/4.0/default/LoudnessEnhancerEffect.cpp b/audio/effect/4.0/default/LoudnessEnhancerEffect.cpp
deleted file mode 100644
index e3c5184..0000000
--- a/audio/effect/4.0/default/LoudnessEnhancerEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "LoudnessEnhancer_HAL"
-
-#include "LoudnessEnhancerEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/LoudnessEnhancerEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/LoudnessEnhancerEffect.h b/audio/effect/4.0/default/LoudnessEnhancerEffect.h
deleted file mode 100644
index 64fa26a..0000000
--- a/audio/effect/4.0/default/LoudnessEnhancerEffect.h
+++ /dev/null
@@ -1,28 +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_V4_0_LOUDNESSENHANCEREFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_LOUDNESSENHANCEREFFECT_H
-
-#include <android/hardware/audio/effect/4.0/ILoudnessEnhancerEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/LoudnessEnhancerEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_LOUDNESSENHANCEREFFECT_H
diff --git a/audio/effect/4.0/default/NoiseSuppressionEffect.cpp b/audio/effect/4.0/default/NoiseSuppressionEffect.cpp
deleted file mode 100644
index e83a8e3..0000000
--- a/audio/effect/4.0/default/NoiseSuppressionEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "NS_Effect_HAL"
-
-#include "NoiseSuppressionEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/NoiseSuppressionEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/NoiseSuppressionEffect.h b/audio/effect/4.0/default/NoiseSuppressionEffect.h
deleted file mode 100644
index 36d45af..0000000
--- a/audio/effect/4.0/default/NoiseSuppressionEffect.h
+++ /dev/null
@@ -1,28 +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_V4_0_NOISESUPPRESSIONEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_NOISESUPPRESSIONEFFECT_H
-
-#include <android/hardware/audio/effect/4.0/INoiseSuppressionEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/NoiseSuppressionEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_NOISESUPPRESSIONEFFECT_H
diff --git a/audio/effect/4.0/default/OWNERS b/audio/effect/4.0/default/OWNERS
deleted file mode 100644
index 6fdc97c..0000000
--- a/audio/effect/4.0/default/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-elaurent@google.com
-krocard@google.com
-mnaganov@google.com
diff --git a/audio/effect/4.0/default/PresetReverbEffect.cpp b/audio/effect/4.0/default/PresetReverbEffect.cpp
deleted file mode 100644
index 0c23be7..0000000
--- a/audio/effect/4.0/default/PresetReverbEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "PresetReverb_HAL"
-
-#include "PresetReverbEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/PresetReverbEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/PresetReverbEffect.h b/audio/effect/4.0/default/PresetReverbEffect.h
deleted file mode 100644
index 3eeae0a..0000000
--- a/audio/effect/4.0/default/PresetReverbEffect.h
+++ /dev/null
@@ -1,28 +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_V4_0_PRESETREVERBEFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_PRESETREVERBEFFECT_H
-
-#include <android/hardware/audio/effect/4.0/IPresetReverbEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/PresetReverbEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_PRESETREVERBEFFECT_H
diff --git a/audio/effect/4.0/default/VirtualizerEffect.cpp b/audio/effect/4.0/default/VirtualizerEffect.cpp
deleted file mode 100644
index f50e8ad..0000000
--- a/audio/effect/4.0/default/VirtualizerEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "Virtualizer_HAL"
-
-#include "VirtualizerEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/VirtualizerEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/VirtualizerEffect.h b/audio/effect/4.0/default/VirtualizerEffect.h
deleted file mode 100644
index 8e7114e..0000000
--- a/audio/effect/4.0/default/VirtualizerEffect.h
+++ /dev/null
@@ -1,28 +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_V4_0_VIRTUALIZEREFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VIRTUALIZEREFFECT_H
-
-#include <android/hardware/audio/effect/4.0/IVirtualizerEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/VirtualizerEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VIRTUALIZEREFFECT_H
diff --git a/audio/effect/4.0/default/VisualizerEffect.cpp b/audio/effect/4.0/default/VisualizerEffect.cpp
deleted file mode 100644
index 8d4f100..0000000
--- a/audio/effect/4.0/default/VisualizerEffect.cpp
+++ /dev/null
@@ -1,23 +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.
- */
-
-#define LOG_TAG "Visualizer_HAL"
-
-#include "VisualizerEffect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/VisualizerEffect.impl.h>
-#undef AUDIO_HAL_VERSION
diff --git a/audio/effect/4.0/default/VisualizerEffect.h b/audio/effect/4.0/default/VisualizerEffect.h
deleted file mode 100644
index 6b5ab9c..0000000
--- a/audio/effect/4.0/default/VisualizerEffect.h
+++ /dev/null
@@ -1,28 +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_V4_0_VISUALIZEREFFECT_H
-#define ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VISUALIZEREFFECT_H
-
-#include <android/hardware/audio/effect/4.0/IVisualizerEffect.h>
-
-#include "Effect.h"
-
-#define AUDIO_HAL_VERSION V4_0
-#include <effect/all-versions/default/VisualizerEffect.h>
-#undef AUDIO_HAL_VERSION
-
-#endif // ANDROID_HARDWARE_AUDIO_EFFECT_V4_0_VISUALIZEREFFECT_H
diff --git a/audio/effect/4.0/vts/OWNERS b/audio/effect/4.0/vts/OWNERS
deleted file mode 100644
index 8711a9f..0000000
--- a/audio/effect/4.0/vts/OWNERS
+++ /dev/null
@@ -1,5 +0,0 @@
-elaurent@google.com
-krocard@google.com
-mnaganov@google.com
-yim@google.com
-zhuoyao@google.com
\ No newline at end of file
diff --git a/audio/effect/4.0/vts/functional/VtsHalAudioEffectV4_0TargetTest.cpp b/audio/effect/4.0/vts/functional/VtsHalAudioEffectV4_0TargetTest.cpp
deleted file mode 100644
index ec783c4..0000000
--- a/audio/effect/4.0/vts/functional/VtsHalAudioEffectV4_0TargetTest.cpp
+++ /dev/null
@@ -1,852 +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 "AudioEffectHidlHalTest"
-#include <android-base/logging.h>
-#include <system/audio.h>
-
-#include <android/hardware/audio/effect/4.0/IEffect.h>
-#include <android/hardware/audio/effect/4.0/IEffectsFactory.h>
-#include <android/hardware/audio/effect/4.0/IEqualizerEffect.h>
-#include <android/hardware/audio/effect/4.0/ILoudnessEnhancerEffect.h>
-#include <android/hardware/audio/effect/4.0/types.h>
-#include <android/hidl/allocator/1.0/IAllocator.h>
-#include <android/hidl/memory/1.0/IMemory.h>
-
-#include <common/all-versions/VersionUtils.h>
-
-#include <VtsHalHidlTargetTestBase.h>
-#include <VtsHalHidlTargetTestEnvBase.h>
-
-using android::hardware::audio::common::V4_0::AudioDevice;
-using android::hardware::audio::common::V4_0::AudioHandleConsts;
-using android::hardware::audio::common::V4_0::AudioMode;
-using android::hardware::audio::common::V4_0::AudioSource;
-using android::hardware::audio::common::V4_0::Uuid;
-using android::hardware::audio::common::utils::mkBitfield;
-using android::hardware::audio::effect::V4_0::AudioBuffer;
-using android::hardware::audio::effect::V4_0::EffectAuxChannelsConfig;
-using android::hardware::audio::effect::V4_0::EffectBufferConfig;
-using android::hardware::audio::effect::V4_0::EffectConfig;
-using android::hardware::audio::effect::V4_0::EffectDescriptor;
-using android::hardware::audio::effect::V4_0::EffectOffloadParameter;
-using android::hardware::audio::effect::V4_0::IEffect;
-using android::hardware::audio::effect::V4_0::IEffectsFactory;
-using android::hardware::audio::effect::V4_0::IEqualizerEffect;
-using android::hardware::audio::effect::V4_0::ILoudnessEnhancerEffect;
-using android::hardware::audio::effect::V4_0::Result;
-using android::hardware::MQDescriptorSync;
-using android::hardware::Return;
-using android::hardware::Void;
-using android::hardware::hidl_handle;
-using android::hardware::hidl_memory;
-using android::hardware::hidl_string;
-using android::hardware::hidl_vec;
-using android::hidl::allocator::V1_0::IAllocator;
-using android::hidl::memory::V1_0::IMemory;
-using android::sp;
-
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
-#endif
-
-// Test environment for Audio Effects Factory HIDL HAL.
-class AudioEffectsFactoryHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
- public:
- // get the test environment singleton
- static AudioEffectsFactoryHidlEnvironment* Instance() {
- static AudioEffectsFactoryHidlEnvironment* instance =
- new AudioEffectsFactoryHidlEnvironment;
- return instance;
- }
-
- virtual void registerTestServices() override { registerTestService<IEffectsFactory>(); }
-};
-
-// The main test class for Audio Effects Factory HIDL HAL.
-class AudioEffectsFactoryHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- public:
- void SetUp() override {
- effectsFactory = ::testing::VtsHalHidlTargetTestBase::getService<IEffectsFactory>(
- AudioEffectsFactoryHidlEnvironment::Instance()->getServiceName<IEffectsFactory>());
- ASSERT_NE(effectsFactory, nullptr);
- }
-
- void TearDown() override { effectsFactory.clear(); }
-
- protected:
- static void description(const std::string& description) {
- RecordProperty("description", description);
- }
-
- sp<IEffectsFactory> effectsFactory;
-};
-
-TEST_F(AudioEffectsFactoryHidlTest, EnumerateEffects) {
- description("Verify that EnumerateEffects returns at least one effect");
- Result retval = Result::NOT_INITIALIZED;
- size_t effectCount = 0;
- Return<void> ret = effectsFactory->getAllDescriptors(
- [&](Result r, const hidl_vec<EffectDescriptor>& result) {
- retval = r;
- effectCount = result.size();
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_GT(effectCount, 0u);
-}
-
-TEST_F(AudioEffectsFactoryHidlTest, CreateEffect) {
- description("Verify that an effect can be created via CreateEffect");
- bool gotEffect = false;
- Uuid effectUuid;
- Return<void> ret = effectsFactory->getAllDescriptors(
- [&](Result r, const hidl_vec<EffectDescriptor>& result) {
- if (r == Result::OK && result.size() > 0) {
- gotEffect = true;
- effectUuid = result[0].uuid;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_TRUE(gotEffect);
- Result retval = Result::NOT_INITIALIZED;
- sp<IEffect> effect;
- ret = effectsFactory->createEffect(
- effectUuid, 1 /*session*/, 1 /*ioHandle*/,
- [&](Result r, const sp<IEffect>& result, uint64_t /*effectId*/) {
- retval = r;
- if (r == Result::OK) {
- effect = result;
- }
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_NE(nullptr, effect.get());
-}
-
-TEST_F(AudioEffectsFactoryHidlTest, GetDescriptor) {
- description(
- "Verify that effects factory can provide an effect descriptor via "
- "GetDescriptor");
- hidl_vec<EffectDescriptor> allDescriptors;
- Return<void> ret = effectsFactory->getAllDescriptors(
- [&](Result r, const hidl_vec<EffectDescriptor>& result) {
- if (r == Result::OK) {
- allDescriptors = result;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_GT(allDescriptors.size(), 0u);
- for (size_t i = 0; i < allDescriptors.size(); ++i) {
- ret = effectsFactory->getDescriptor(
- allDescriptors[i].uuid, [&](Result r, const EffectDescriptor& result) {
- EXPECT_EQ(r, Result::OK);
- EXPECT_EQ(result, allDescriptors[i]);
- });
- }
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectsFactoryHidlTest, DebugDumpInvalidArgument) {
- description("Verify that debugDump doesn't crash on invalid arguments");
- Return<void> ret = effectsFactory->debug(hidl_handle(), {});
- ASSERT_TRUE(ret.isOk());
-}
-
-// Equalizer effect is required by CDD, but only the type is fixed.
-// This is the same UUID as AudioEffect.EFFECT_TYPE_EQUALIZER in Java.
-static const Uuid EQUALIZER_EFFECT_TYPE = {
- 0x0bed4300, 0xddd6, 0x11db, 0x8f34,
- std::array<uint8_t, 6>{{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}};
-// Loudness Enhancer effect is required by CDD, but only the type is fixed.
-// This is the same UUID as AudioEffect.EFFECT_TYPE_LOUDNESS_ENHANCER in Java.
-static const Uuid LOUDNESS_ENHANCER_EFFECT_TYPE = {
- 0xfe3199be, 0xaed0, 0x413f, 0x87bb,
- std::array<uint8_t, 6>{{0x11, 0x26, 0x0e, 0xb6, 0x3c, 0xf1}}};
-
-// The main test class for Audio Effect HIDL HAL.
-class AudioEffectHidlTest : public ::testing::VtsHalHidlTargetTestBase {
- public:
- void SetUp() override {
- effectsFactory =
- ::testing::VtsHalHidlTargetTestBase::getService<IEffectsFactory>();
- ASSERT_NE(nullptr, effectsFactory.get());
-
- findAndCreateEffect(getEffectType());
- ASSERT_NE(nullptr, effect.get());
-
- Return<Result> ret = effect->init();
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, ret);
- }
-
- void TearDown() override {
- effect.clear();
- effectsFactory.clear();
- }
-
- protected:
- static void description(const std::string& description) {
- RecordProperty("description", description);
- }
-
- virtual Uuid getEffectType() { return EQUALIZER_EFFECT_TYPE; }
-
- void findAndCreateEffect(const Uuid& type);
- void findEffectInstance(const Uuid& type, Uuid* uuid);
- void getChannelCount(uint32_t* channelCount);
-
- sp<IEffectsFactory> effectsFactory;
- sp<IEffect> effect;
-};
-
-void AudioEffectHidlTest::findAndCreateEffect(const Uuid& type) {
- Uuid effectUuid;
- findEffectInstance(type, &effectUuid);
- Return<void> ret = effectsFactory->createEffect(
- effectUuid, 1 /*session*/, 1 /*ioHandle*/,
- [&](Result r, const sp<IEffect>& result, uint64_t /*effectId*/) {
- if (r == Result::OK) {
- effect = result;
- }
- });
- ASSERT_TRUE(ret.isOk());
-}
-
-void AudioEffectHidlTest::findEffectInstance(const Uuid& type, Uuid* uuid) {
- bool effectFound = false;
- Return<void> ret = effectsFactory->getAllDescriptors(
- [&](Result r, const hidl_vec<EffectDescriptor>& result) {
- if (r == Result::OK) {
- for (const auto& desc : result) {
- if (desc.type == type) {
- effectFound = true;
- *uuid = desc.uuid;
- break;
- }
- }
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_TRUE(effectFound);
-}
-
-void AudioEffectHidlTest::getChannelCount(uint32_t* channelCount) {
- Result retval;
- EffectConfig currentConfig;
- Return<void> ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
- retval = r;
- if (r == Result::OK) {
- currentConfig = conf;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
- ASSERT_TRUE(audio_channel_mask_is_valid(
- static_cast<audio_channel_mask_t>(currentConfig.outputCfg.channels)));
- *channelCount = audio_channel_count_from_out_mask(
- static_cast<audio_channel_mask_t>(currentConfig.outputCfg.channels));
-}
-
-TEST_F(AudioEffectHidlTest, Close) {
- description("Verify that an effect can be closed");
- Return<Result> ret = effect->close();
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, GetDescriptor) {
- description(
- "Verify that an effect can return its own descriptor via GetDescriptor");
- Result retval = Result::NOT_INITIALIZED;
- Uuid actualType;
- Return<void> ret =
- effect->getDescriptor([&](Result r, const EffectDescriptor& desc) {
- retval = r;
- if (r == Result::OK) {
- actualType = desc.type;
- }
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(getEffectType(), actualType);
-}
-
-TEST_F(AudioEffectHidlTest, GetSetConfig) {
- description(
- "Verify that it is possible to manipulate effect config via Get / "
- "SetConfig");
- Result retval = Result::NOT_INITIALIZED;
- EffectConfig currentConfig;
- Return<void> ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
- retval = r;
- if (r == Result::OK) {
- currentConfig = conf;
- }
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- Return<Result> ret2 = effect->setConfig(currentConfig, nullptr, nullptr);
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, ret2);
-}
-
-TEST_F(AudioEffectHidlTest, GetConfigReverse) {
- description("Verify that GetConfigReverse does not crash");
- Return<void> ret =
- effect->getConfigReverse([&](Result, const EffectConfig&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetSupportedAuxChannelsConfigs) {
- description("Verify that GetSupportedAuxChannelsConfigs does not crash");
- Return<void> ret = effect->getSupportedAuxChannelsConfigs(
- 0, [&](Result, const hidl_vec<EffectAuxChannelsConfig>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetAuxChannelsConfig) {
- description("Verify that GetAuxChannelsConfig does not crash");
- Return<void> ret = effect->getAuxChannelsConfig(
- [&](Result, const EffectAuxChannelsConfig&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetAuxChannelsConfig) {
- description("Verify that SetAuxChannelsConfig does not crash");
- Return<Result> ret = effect->setAuxChannelsConfig(EffectAuxChannelsConfig());
- EXPECT_TRUE(ret.isOk());
-}
-
-// Not generated automatically because AudioBuffer contains
-// instances of hidl_memory which can't be compared properly
-// in general case due to presence of handles.
-//
-// However, in this particular case, handles must not present
-// thus comparison is possible.
-//
-// operator== must be defined in the same namespace as the structures.
-namespace android {
-namespace hardware {
-namespace audio {
-namespace effect {
-namespace V4_0 {
-inline bool operator==(const AudioBuffer& lhs, const AudioBuffer& rhs) {
- return lhs.id == rhs.id && lhs.frameCount == rhs.frameCount &&
- lhs.data.handle() == nullptr && rhs.data.handle() == nullptr;
-}
-
-inline bool operator==(const EffectBufferConfig& lhs,
- const EffectBufferConfig& rhs) {
- return lhs.buffer == rhs.buffer && lhs.samplingRateHz == rhs.samplingRateHz &&
- lhs.channels == rhs.channels && lhs.format == rhs.format &&
- lhs.accessMode == rhs.accessMode && lhs.mask == rhs.mask;
-}
-
-inline bool operator==(const EffectConfig& lhs, const EffectConfig& rhs) {
- return lhs.inputCfg == rhs.inputCfg && lhs.outputCfg == rhs.outputCfg;
-}
-} // namespace V4_0
-} // namespace effect
-} // namespace audio
-} // namespace hardware
-} // namespace android
-
-TEST_F(AudioEffectHidlTest, Reset) {
- description("Verify that Reset preserves effect configuration");
- Result retval = Result::NOT_INITIALIZED;
- EffectConfig originalConfig;
- Return<void> ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
- retval = r;
- if (r == Result::OK) {
- originalConfig = conf;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
- Return<Result> ret2 = effect->reset();
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, ret2);
- EffectConfig configAfterReset;
- ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
- retval = r;
- if (r == Result::OK) {
- configAfterReset = conf;
- }
- });
- EXPECT_EQ(originalConfig, configAfterReset);
-}
-
-TEST_F(AudioEffectHidlTest, DisableEnableDisable) {
- description("Verify Disable -> Enable -> Disable sequence for an effect");
- Return<Result> ret = effect->disable();
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::INVALID_ARGUMENTS, ret);
- ret = effect->enable();
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- ret = effect->disable();
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, SetDevice) {
- description("Verify that SetDevice works for an output chain effect");
- Return<Result> ret = effect->setDevice(mkBitfield(AudioDevice::OUT_SPEAKER));
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, SetAndGetVolume) {
- description("Verify that SetAndGetVolume method works for an effect");
- uint32_t channelCount;
- getChannelCount(&channelCount);
- hidl_vec<uint32_t> volumes;
- volumes.resize(channelCount);
- for (uint32_t i = 0; i < channelCount; ++i) {
- volumes[i] = 0;
- }
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = effect->setAndGetVolume(
- volumes, [&](Result r, const hidl_vec<uint32_t>&) { retval = r; });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
-}
-
-TEST_F(AudioEffectHidlTest, VolumeChangeNotification) {
- description("Verify that effect accepts VolumeChangeNotification");
- uint32_t channelCount;
- getChannelCount(&channelCount);
- hidl_vec<uint32_t> volumes;
- volumes.resize(channelCount);
- for (uint32_t i = 0; i < channelCount; ++i) {
- volumes[i] = 0;
- }
- Return<Result> ret = effect->volumeChangeNotification(volumes);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, SetAudioMode) {
- description("Verify that SetAudioMode works for an effect");
- Return<Result> ret = effect->setAudioMode(AudioMode::NORMAL);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
-}
-
-TEST_F(AudioEffectHidlTest, SetConfigReverse) {
- description("Verify that SetConfigReverse does not crash");
- Return<Result> ret =
- effect->setConfigReverse(EffectConfig(), nullptr, nullptr);
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetInputDevice) {
- description("Verify that SetInputDevice does not crash");
- Return<Result> ret = effect->setInputDevice(mkBitfield(AudioDevice::IN_BUILTIN_MIC));
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetAudioSource) {
- description("Verify that SetAudioSource does not crash");
- Return<Result> ret = effect->setAudioSource(AudioSource::MIC);
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, Offload) {
- description("Verify that calling Offload method does not crash");
- EffectOffloadParameter offloadParam;
- offloadParam.isOffload = false;
- offloadParam.ioHandle =
- static_cast<int>(AudioHandleConsts::AUDIO_IO_HANDLE_NONE);
- Return<Result> ret = effect->offload(offloadParam);
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, PrepareForProcessing) {
- description("Verify that PrepareForProcessing method works for an effect");
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = effect->prepareForProcessing(
- [&](Result r, const MQDescriptorSync<Result>&) { retval = r; });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
-}
-
-TEST_F(AudioEffectHidlTest, SetProcessBuffers) {
- description("Verify that SetProcessBuffers works for an effect");
- sp<IAllocator> ashmem = IAllocator::getService("ashmem");
- ASSERT_NE(nullptr, ashmem.get());
- bool success = false;
- AudioBuffer buffer;
- Return<void> ret =
- ashmem->allocate(1024, [&](bool s, const hidl_memory& memory) {
- success = s;
- if (s) {
- buffer.data = memory;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_TRUE(success);
- Return<Result> ret2 = effect->setProcessBuffers(buffer, buffer);
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, ret2);
-}
-
-TEST_F(AudioEffectHidlTest, Command) {
- description("Verify that Command does not crash");
- Return<void> ret = effect->command(0, hidl_vec<uint8_t>(), 0,
- [&](int32_t, const hidl_vec<uint8_t>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetParameter) {
- description("Verify that SetParameter does not crash");
- Return<Result> ret =
- effect->setParameter(hidl_vec<uint8_t>(), hidl_vec<uint8_t>());
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetParameter) {
- description("Verify that GetParameter does not crash");
- Return<void> ret = effect->getParameter(
- hidl_vec<uint8_t>(), 0, [&](Result, const hidl_vec<uint8_t>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetSupportedConfigsForFeature) {
- description("Verify that GetSupportedConfigsForFeature does not crash");
- Return<void> ret = effect->getSupportedConfigsForFeature(
- 0, 0, 0, [&](Result, uint32_t, const hidl_vec<uint8_t>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, GetCurrentConfigForFeature) {
- description("Verify that GetCurrentConfigForFeature does not crash");
- Return<void> ret = effect->getCurrentConfigForFeature(
- 0, 0, [&](Result, const hidl_vec<uint8_t>&) {});
- EXPECT_TRUE(ret.isOk());
-}
-
-TEST_F(AudioEffectHidlTest, SetCurrentConfigForFeature) {
- description("Verify that SetCurrentConfigForFeature does not crash");
- Return<Result> ret =
- effect->setCurrentConfigForFeature(0, hidl_vec<uint8_t>());
- EXPECT_TRUE(ret.isOk());
-}
-
-
-// The main test class for Equalizer Audio Effect HIDL HAL.
-class EqualizerAudioEffectHidlTest : public AudioEffectHidlTest {
- public:
- void SetUp() override {
- AudioEffectHidlTest::SetUp();
- equalizer = IEqualizerEffect::castFrom(effect);
- ASSERT_NE(nullptr, equalizer.get());
- }
-
- protected:
- Uuid getEffectType() override { return EQUALIZER_EFFECT_TYPE; }
- void getNumBands(uint16_t* numBands);
- void getLevelRange(int16_t* minLevel, int16_t* maxLevel);
- void getBandFrequencyRange(uint16_t band, uint32_t* minFreq,
- uint32_t* centerFreq, uint32_t* maxFreq);
- void getPresetCount(size_t* count);
-
- sp<IEqualizerEffect> equalizer;
-};
-
-void EqualizerAudioEffectHidlTest::getNumBands(uint16_t* numBands) {
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = equalizer->getNumBands([&](Result r, uint16_t b) {
- retval = r;
- if (retval == Result::OK) {
- *numBands = b;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
-}
-
-void EqualizerAudioEffectHidlTest::getLevelRange(int16_t* minLevel,
- int16_t* maxLevel) {
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret =
- equalizer->getLevelRange([&](Result r, int16_t min, int16_t max) {
- retval = r;
- if (retval == Result::OK) {
- *minLevel = min;
- *maxLevel = max;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
-}
-
-void EqualizerAudioEffectHidlTest::getBandFrequencyRange(uint16_t band,
- uint32_t* minFreq,
- uint32_t* centerFreq,
- uint32_t* maxFreq) {
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = equalizer->getBandFrequencyRange(
- band, [&](Result r, uint32_t min, uint32_t max) {
- retval = r;
- if (retval == Result::OK) {
- *minFreq = min;
- *maxFreq = max;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
- ret = equalizer->getBandCenterFrequency(band, [&](Result r, uint32_t center) {
- retval = r;
- if (retval == Result::OK) {
- *centerFreq = center;
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
-}
-
-void EqualizerAudioEffectHidlTest::getPresetCount(size_t* count) {
- Result retval = Result::NOT_INITIALIZED;
- Return<void> ret = equalizer->getPresetNames(
- [&](Result r, const hidl_vec<hidl_string>& names) {
- retval = r;
- if (retval == Result::OK) {
- *count = names.size();
- }
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Result::OK, retval);
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetNumBands) {
- description("Verify that Equalizer effect reports at least one band");
- uint16_t numBands = 0;
- getNumBands(&numBands);
- EXPECT_GT(numBands, 0);
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetLevelRange) {
- description("Verify that Equalizer effect reports adequate band level range");
- int16_t minLevel = 0x7fff, maxLevel = 0;
- getLevelRange(&minLevel, &maxLevel);
- EXPECT_GT(maxLevel, minLevel);
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetSetBandLevel) {
- description(
- "Verify that manipulating band levels works for Equalizer effect");
- uint16_t numBands = 0;
- getNumBands(&numBands);
- ASSERT_GT(numBands, 0);
- int16_t levels[3]{0x7fff, 0, 0};
- getLevelRange(&levels[0], &levels[2]);
- ASSERT_GT(levels[2], levels[0]);
- levels[1] = (levels[2] + levels[0]) / 2;
- for (uint16_t i = 0; i < numBands; ++i) {
- for (size_t j = 0; j < ARRAY_SIZE(levels); ++j) {
- Return<Result> ret = equalizer->setBandLevel(i, levels[j]);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- Result retval = Result::NOT_INITIALIZED;
- int16_t actualLevel;
- Return<void> ret2 = equalizer->getBandLevel(i, [&](Result r, int16_t l) {
- retval = r;
- if (retval == Result::OK) {
- actualLevel = l;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(levels[j], actualLevel);
- }
- }
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetBandCenterFrequencyAndRange) {
- description(
- "Verify that Equalizer effect reports adequate band frequency range");
- uint16_t numBands = 0;
- getNumBands(&numBands);
- ASSERT_GT(numBands, 0);
- for (uint16_t i = 0; i < numBands; ++i) {
- uint32_t minFreq = 0xffffffff, centerFreq = 0xffffffff,
- maxFreq = 0xffffffff;
- getBandFrequencyRange(i, &minFreq, ¢erFreq, &maxFreq);
- // Note: NXP legacy implementation reports "1" as upper bound for last band,
- // so this check fails.
- EXPECT_GE(maxFreq, centerFreq);
- EXPECT_GE(centerFreq, minFreq);
- }
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetBandForFrequency) {
- description(
- "Verify that Equalizer effect supports GetBandForFrequency correctly");
- uint16_t numBands = 0;
- getNumBands(&numBands);
- ASSERT_GT(numBands, 0);
- for (uint16_t i = 0; i < numBands; ++i) {
- uint32_t freqs[3]{0, 0, 0};
- getBandFrequencyRange(i, &freqs[0], &freqs[1], &freqs[2]);
- // NXP legacy implementation reports "1" as upper bound for last band, some
- // of the checks fail.
- for (size_t j = 0; j < ARRAY_SIZE(freqs); ++j) {
- if (j == 0) {
- freqs[j]++;
- } // Min frequency is an open interval.
- Result retval = Result::NOT_INITIALIZED;
- uint16_t actualBand = numBands + 1;
- Return<void> ret =
- equalizer->getBandForFrequency(freqs[j], [&](Result r, uint16_t b) {
- retval = r;
- if (retval == Result::OK) {
- actualBand = b;
- }
- });
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(i, actualBand) << "Frequency: " << freqs[j];
- }
- }
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetPresetNames) {
- description("Verify that Equalizer effect reports at least one preset");
- size_t presetCount;
- getPresetCount(&presetCount);
- EXPECT_GT(presetCount, 0u);
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetSetCurrentPreset) {
- description(
- "Verify that manipulating the current preset for Equalizer effect");
- size_t presetCount;
- getPresetCount(&presetCount);
- ASSERT_GT(presetCount, 0u);
- for (uint16_t i = 0; i < presetCount; ++i) {
- Return<Result> ret = equalizer->setCurrentPreset(i);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- Result retval = Result::NOT_INITIALIZED;
- uint16_t actualPreset = 0xffff;
- Return<void> ret2 = equalizer->getCurrentPreset([&](Result r, uint16_t p) {
- retval = r;
- if (retval == Result::OK) {
- actualPreset = p;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(i, actualPreset);
- }
-}
-
-TEST_F(EqualizerAudioEffectHidlTest, GetSetAllProperties) {
- description(
- "Verify that setting band levels and presets works via Get / "
- "SetAllProperties for Equalizer effect");
- using AllProperties =
- android::hardware::audio::effect::V4_0::IEqualizerEffect::AllProperties;
- uint16_t numBands = 0;
- getNumBands(&numBands);
- ASSERT_GT(numBands, 0);
- AllProperties props;
- props.bandLevels.resize(numBands);
- for (size_t i = 0; i < numBands; ++i) {
- props.bandLevels[i] = 0;
- }
-
- AllProperties actualProps;
- Result retval = Result::NOT_INITIALIZED;
-
- // Verify setting of the band levels via properties.
- props.curPreset = -1;
- Return<Result> ret = equalizer->setAllProperties(props);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- Return<void> ret2 =
- equalizer->getAllProperties([&](Result r, AllProperties p) {
- retval = r;
- if (retval == Result::OK) {
- actualProps = p;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(props.bandLevels, actualProps.bandLevels);
-
- // Verify setting of the current preset via properties.
- props.curPreset = 0; // Assuming there is at least one preset.
- ret = equalizer->setAllProperties(props);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- ret2 = equalizer->getAllProperties([&](Result r, AllProperties p) {
- retval = r;
- if (retval == Result::OK) {
- actualProps = p;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(props.curPreset, actualProps.curPreset);
-}
-
-// The main test class for Equalizer Audio Effect HIDL HAL.
-class LoudnessEnhancerAudioEffectHidlTest : public AudioEffectHidlTest {
- public:
- void SetUp() override {
- AudioEffectHidlTest::SetUp();
- enhancer = ILoudnessEnhancerEffect::castFrom(effect);
- ASSERT_NE(nullptr, enhancer.get());
- }
-
- protected:
- Uuid getEffectType() override { return LOUDNESS_ENHANCER_EFFECT_TYPE; }
-
- sp<ILoudnessEnhancerEffect> enhancer;
-};
-
-TEST_F(LoudnessEnhancerAudioEffectHidlTest, GetSetTargetGain) {
- description(
- "Verify that manipulating the target gain works for Loudness Enhancer "
- "effect");
- const int32_t gain = 100;
- Return<Result> ret = enhancer->setTargetGain(gain);
- EXPECT_TRUE(ret.isOk());
- EXPECT_EQ(Result::OK, ret);
- int32_t actualGain = 0;
- Result retval;
- Return<void> ret2 = enhancer->getTargetGain([&](Result r, int32_t g) {
- retval = r;
- if (retval == Result::OK) {
- actualGain = g;
- }
- });
- EXPECT_TRUE(ret2.isOk());
- EXPECT_EQ(Result::OK, retval);
- EXPECT_EQ(gain, actualGain);
-}
-
-int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(AudioEffectsFactoryHidlEnvironment::Instance());
- ::testing::InitGoogleTest(&argc, argv);
- AudioEffectsFactoryHidlEnvironment::Instance()->init(&argc, argv);
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
- return status;
-}
diff --git a/audio/effect/4.0/xml/audio_effects_conf.xsd b/audio/effect/4.0/xml/audio_effects_conf.xsd
new file mode 120000
index 0000000..9d85fa7
--- /dev/null
+++ b/audio/effect/4.0/xml/audio_effects_conf.xsd
@@ -0,0 +1 @@
+../../2.0/xml/audio_effects_conf.xsd
\ No newline at end of file
diff --git a/audio/effect/4.0/xml/audio_effects_conf_V4_0.xsd b/audio/effect/4.0/xml/audio_effects_conf_V4_0.xsd
deleted file mode 120000
index 82d569a..0000000
--- a/audio/effect/4.0/xml/audio_effects_conf_V4_0.xsd
+++ /dev/null
@@ -1 +0,0 @@
-../../2.0/xml/audio_effects_conf_V2_0.xsd
\ No newline at end of file
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.impl.h b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.cpp
similarity index 94%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.impl.h
rename to audio/effect/all-versions/default/AcousticEchoCancelerEffect.cpp
index 8ad80a2..0b60622 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.impl.h
+++ b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "AEC_Effect_HAL"
+
+#include "AcousticEchoCancelerEffect.h"
#include <android/log.h>
#include <system/audio_effects/effect_aec.h>
@@ -25,7 +27,7 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
AcousticEchoCancelerEffect::AcousticEchoCancelerEffect(effect_handle_t handle)
@@ -33,7 +35,7 @@
AcousticEchoCancelerEffect::~AcousticEchoCancelerEffect() {}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> AcousticEchoCancelerEffect::init() {
return mEffect->init();
}
@@ -163,7 +165,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAcousticEchoCancelerEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IAcousticEchoCancelerEffect
// follow.
Return<Result> AcousticEchoCancelerEffect::setEchoDelay(uint32_t echoDelayMs) {
return mEffect->setParam(AEC_PARAM_ECHO_DELAY, echoDelayMs);
@@ -174,7 +176,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.h b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.h
similarity index 85%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.h
rename to audio/effect/all-versions/default/AcousticEchoCancelerEffect.h
index 852cb3f..c18f88b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AcousticEchoCancelerEffect.h
+++ b/audio/effect/all-versions/default/AcousticEchoCancelerEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_ACOUSTICECHOCANCELEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_ACOUSTICECHOCANCELEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IAcousticEchoCancelerEffect.h)
+
+#include "Effect.h"
#include <hidl/Status.h>
@@ -26,21 +31,21 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAcousticEchoCancelerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::effect::CPP_VERSION::IAcousticEchoCancelerEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct AcousticEchoCancelerEffect : public IAcousticEchoCancelerEffect {
explicit AcousticEchoCancelerEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -85,7 +90,7 @@
Return<Result> close() override;
// Methods from
- // ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAcousticEchoCancelerEffect follow.
+ // ::android::hardware::audio::effect::CPP_VERSION::IAcousticEchoCancelerEffect follow.
Return<Result> setEchoDelay(uint32_t echoDelayMs) override;
Return<void> getEchoDelay(getEchoDelay_cb _hidl_cb) override;
@@ -96,8 +101,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_ACOUSTICECHOCANCELEREFFECT_H
diff --git a/audio/effect/all-versions/default/Android.bp b/audio/effect/all-versions/default/Android.bp
index ed2a093..9c2cdbc 100644
--- a/audio/effect/all-versions/default/Android.bp
+++ b/audio/effect/all-versions/default/Android.bp
@@ -1,10 +1,25 @@
-cc_library_headers {
- name: "android.hardware.audio.effect@all-versions-impl",
+cc_defaults {
+ name: "android.hardware.audio.effect-impl_default",
defaults: ["hidl_defaults"],
vendor: true,
relative_install_path: "hw",
-
- export_include_dirs: ["include"],
+ 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",
@@ -21,11 +36,43 @@
],
header_libs: [
+ "android.hardware.audio.common.util@all-versions",
"libaudio_system_headers",
"libaudioclient_headers",
"libeffects_headers",
"libhardware_headers",
"libmedia_headers",
- "android.hardware.audio.common.util@all-versions",
],
}
+
+cc_library_shared {
+ name: "android.hardware.audio.effect@2.0-impl",
+ defaults: ["android.hardware.audio.effect-impl_default"],
+ shared_libs: [
+ "android.hardware.audio.common@2.0",
+ "android.hardware.audio.common@2.0-util",
+ "android.hardware.audio.effect@2.0",
+ ],
+
+ cflags: [
+ "-DMAJOR_VERSION=2",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
+}
+
+cc_library_shared {
+ name: "android.hardware.audio.effect@4.0-impl",
+ defaults: ["android.hardware.audio.effect-impl_default"],
+ shared_libs: [
+ "android.hardware.audio.common@4.0",
+ "android.hardware.audio.common@4.0-util",
+ "android.hardware.audio.effect@4.0",
+ ],
+
+ cflags: [
+ "-DMAJOR_VERSION=4",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
+}
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.impl.h b/audio/effect/all-versions/default/AudioBufferManager.cpp
similarity index 93%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.impl.h
rename to audio/effect/all-versions/default/AudioBufferManager.cpp
index 71ccd2d..9a638fd 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.impl.h
+++ b/audio/effect/all-versions/default/AudioBufferManager.cpp
@@ -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.
*/
-#include <common/all-versions/IncludeGuard.h>
+#include "AudioBufferManager.h"
#include <atomic>
@@ -53,7 +53,7 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
AudioBufferWrapper::AudioBufferWrapper(const AudioBuffer& buffer)
@@ -83,7 +83,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.h b/audio/effect/all-versions/default/AudioBufferManager.h
similarity index 75%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.h
rename to audio/effect/all-versions/default/AudioBufferManager.h
index 34dea2d..8b956cd 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AudioBufferManager.h
+++ b/audio/effect/all-versions/default/AudioBufferManager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,10 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_AUDIO_BUFFER_MANAGER_H_
+#define ANDROID_HARDWARE_AUDIO_EFFECT_AUDIO_BUFFER_MANAGER_H_
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/types.h)
#include <mutex>
@@ -24,14 +27,14 @@
#include <utils/RefBase.h>
#include <utils/Singleton.h>
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
using ::android::hidl::memory::V1_0::IMemory;
namespace android {
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
class AudioBufferWrapper : public RefBase {
@@ -51,13 +54,13 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::implementation::AudioBufferWrapper;
+using ::android::hardware::audio::effect::CPP_VERSION::implementation::AudioBufferWrapper;
namespace android {
@@ -67,7 +70,7 @@
bool wrap(const AudioBuffer& buffer, sp<AudioBufferWrapper>* wrapper);
private:
- friend class hardware::audio::effect::AUDIO_HAL_VERSION::implementation::AudioBufferWrapper;
+ friend class hardware::audio::effect::CPP_VERSION::implementation::AudioBufferWrapper;
// Called by AudioBufferWrapper.
void removeEntry(uint64_t id);
@@ -77,3 +80,5 @@
};
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_AUDIO_BUFFER_MANAGER_H_
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.impl.h b/audio/effect/all-versions/default/AutomaticGainControlEffect.cpp
similarity index 95%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.impl.h
rename to audio/effect/all-versions/default/AutomaticGainControlEffect.cpp
index e2e751e..651dd1b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.impl.h
+++ b/audio/effect/all-versions/default/AutomaticGainControlEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "AGC_Effect_HAL"
+
+#include "AutomaticGainControlEffect.h"
#include <android/log.h>
@@ -24,7 +26,7 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
AutomaticGainControlEffect::AutomaticGainControlEffect(effect_handle_t handle)
@@ -46,7 +48,7 @@
halProperties->limiterEnabled = properties.limiterEnabled;
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> AutomaticGainControlEffect::init() {
return mEffect->init();
}
@@ -176,7 +178,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAutomaticGainControlEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IAutomaticGainControlEffect
// follow.
Return<Result> AutomaticGainControlEffect::setTargetLevel(int16_t targetLevelMb) {
return mEffect->setParam(AGC_PARAM_TARGET_LEVEL, targetLevelMb);
@@ -219,7 +221,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.h b/audio/effect/all-versions/default/AutomaticGainControlEffect.h
similarity index 87%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.h
rename to audio/effect/all-versions/default/AutomaticGainControlEffect.h
index 5ac43eb..a281b1d 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/AutomaticGainControlEffect.h
+++ b/audio/effect/all-versions/default/AutomaticGainControlEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_AUTOMATICGAINCONTROLEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_AUTOMATICGAINCONTROLEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IAutomaticGainControlEffect.h)
+
+#include "Effect.h"
#include <system/audio_effects/effect_agc.h>
@@ -28,21 +33,21 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAutomaticGainControlEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::effect::CPP_VERSION::IAutomaticGainControlEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct AutomaticGainControlEffect : public IAutomaticGainControlEffect {
explicit AutomaticGainControlEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -87,7 +92,7 @@
Return<Result> close() override;
// Methods from
- // ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IAutomaticGainControlEffect follow.
+ // ::android::hardware::audio::effect::CPP_VERSION::IAutomaticGainControlEffect follow.
Return<Result> setTargetLevel(int16_t targetLevelMb) override;
Return<void> getTargetLevel(getTargetLevel_cb _hidl_cb) override;
Return<Result> setCompGain(int16_t compGainMb) override;
@@ -110,8 +115,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_AUTOMATICGAINCONTROLEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.impl.h b/audio/effect/all-versions/default/BassBoostEffect.cpp
similarity index 93%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.impl.h
rename to audio/effect/all-versions/default/BassBoostEffect.cpp
index 7bcb4a3..6f7763d 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.impl.h
+++ b/audio/effect/all-versions/default/BassBoostEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "BassBoost_HAL"
+
+#include "BassBoostEffect.h"
#include <android/log.h>
#include <system/audio_effects/effect_bassboost.h>
@@ -25,14 +27,14 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
BassBoostEffect::BassBoostEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
BassBoostEffect::~BassBoostEffect() {}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> BassBoostEffect::init() {
return mEffect->init();
}
@@ -159,7 +161,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IBassBoostEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect follow.
Return<void> BassBoostEffect::isStrengthSupported(isStrengthSupported_cb _hidl_cb) {
return mEffect->getIntegerParam(BASSBOOST_PARAM_STRENGTH_SUPPORTED, _hidl_cb);
}
@@ -173,7 +175,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.h b/audio/effect/all-versions/default/BassBoostEffect.h
similarity index 85%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.h
rename to audio/effect/all-versions/default/BassBoostEffect.h
index 29173dd..a184ac2 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/BassBoostEffect.h
+++ b/audio/effect/all-versions/default/BassBoostEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,14 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IBassBoostEffect.h)
+
+#include <hidl/MQDescriptor.h>
+
+#include "Effect.h"
#include <hidl/Status.h>
@@ -26,21 +33,21 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IBassBoostEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct BassBoostEffect : public IBassBoostEffect {
explicit BassBoostEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -84,7 +91,7 @@
const hidl_vec<uint8_t>& configData) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IBassBoostEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect follow.
Return<void> isStrengthSupported(isStrengthSupported_cb _hidl_cb) override;
Return<Result> setStrength(uint16_t strength) override;
Return<void> getStrength(getStrength_cb _hidl_cb) override;
@@ -96,8 +103,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h b/audio/effect/all-versions/default/Conversions.cpp
similarity index 80%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h
rename to audio/effect/all-versions/default/Conversions.cpp
index de67d89..50b0562 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.impl.h
+++ b/audio/effect/all-versions/default/Conversions.cpp
@@ -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,31 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#include "Conversions.h"
+#include "HidlUtils.h"
+
+using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
#include <memory.h>
#include <stdio.h>
#include <common/all-versions/VersionUtils.h>
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils;
-using ::android::hardware::audio::common::utils::mkEnumConverter;
+using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
+using ::android::hardware::audio::common::utils::EnumBitfield;
namespace android {
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
void effectDescriptorFromHal(const effect_descriptor_t& halDescriptor,
EffectDescriptor* descriptor) {
HidlUtils::uuidFromHal(halDescriptor.type, &descriptor->type);
HidlUtils::uuidFromHal(halDescriptor.uuid, &descriptor->uuid);
- descriptor->flags = mkEnumConverter<EffectFlags>(halDescriptor.flags);
+ descriptor->flags = EnumBitfield<EffectFlags>(halDescriptor.flags);
descriptor->cpuLoad = halDescriptor.cpuLoad;
descriptor->memoryUsage = halDescriptor.memoryUsage;
memcpy(descriptor->name.data(), halDescriptor.name, descriptor->name.size());
@@ -52,7 +55,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.h b/audio/effect/all-versions/default/Conversions.h
similarity index 71%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.h
rename to audio/effect/all-versions/default/Conversions.h
index 3f9317f..75aab24 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/Conversions.h
+++ b/audio/effect/all-versions/default/Conversions.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,10 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_CONVERSIONS_H_
+#define ANDROID_HARDWARE_AUDIO_EFFECT_CONVERSIONS_H_
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/types.h)
#include <string>
@@ -24,18 +27,20 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
void effectDescriptorFromHal(const effect_descriptor_t& halDescriptor,
EffectDescriptor* descriptor);
std::string uuidToString(const effect_uuid_t& halUuid);
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_CONVERSIONS_H_
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.impl.h b/audio/effect/all-versions/default/DownmixEffect.cpp
similarity index 93%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.impl.h
rename to audio/effect/all-versions/default/DownmixEffect.cpp
index abef10e..94da70e 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.impl.h
+++ b/audio/effect/all-versions/default/DownmixEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "Downmix_HAL"
+
+#include "DownmixEffect.h"
#include <android/log.h>
#include <system/audio_effects/effect_downmix.h>
@@ -25,14 +27,14 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
DownmixEffect::DownmixEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
DownmixEffect::~DownmixEffect() {}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> DownmixEffect::init() {
return mEffect->init();
}
@@ -159,7 +161,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IDownmixEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IDownmixEffect follow.
Return<Result> DownmixEffect::setType(IDownmixEffect::Type preset) {
return mEffect->setParam(DOWNMIX_PARAM_TYPE, static_cast<downmix_type_t>(preset));
}
@@ -172,7 +174,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.h b/audio/effect/all-versions/default/DownmixEffect.h
similarity index 86%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.h
rename to audio/effect/all-versions/default/DownmixEffect.h
index 3e3aa78..6d34c28 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/DownmixEffect.h
+++ b/audio/effect/all-versions/default/DownmixEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_DOWNMIXEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_DOWNMIXEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IDownmixEffect.h)
+
+#include "Effect.h"
#include <hidl/Status.h>
@@ -26,21 +31,21 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IDownmixEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::effect::CPP_VERSION::IDownmixEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct DownmixEffect : public IDownmixEffect {
explicit DownmixEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -84,7 +89,7 @@
const hidl_vec<uint8_t>& configData) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IDownmixEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IDownmixEffect follow.
Return<Result> setType(IDownmixEffect::Type preset) override;
Return<void> getType(getType_cb _hidl_cb) override;
@@ -95,8 +100,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_DOWNMIXEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.impl.h b/audio/effect/all-versions/default/Effect.cpp
similarity index 97%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/Effect.impl.h
rename to audio/effect/all-versions/default/Effect.cpp
index 61c9805..3e5148f 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.impl.h
+++ b/audio/effect/all-versions/default/Effect.cpp
@@ -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>
+#include <memory.h>
+
+#define LOG_TAG "EffectHAL"
+#define ATRACE_TAG ATRACE_TAG_AUDIO
+
+#include "Conversions.h"
+#include "Effect.h"
+#include "common/all-versions/default/EffectMap.h"
#include <memory.h>
@@ -30,13 +37,13 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::MessageQueueFlagBits;
+using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
+using ::android::hardware::audio::common::CPP_VERSION::AudioFormat;
+using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield;
+using ::android::hardware::audio::effect::CPP_VERSION::MessageQueueFlagBits;
namespace {
@@ -479,7 +486,7 @@
&halParamBuffer[0]);
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> Effect::init() {
return sendCommandReturningStatus(EFFECT_CMD_INIT, "INIT");
}
@@ -707,7 +714,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.h b/audio/effect/all-versions/default/Effect.h
similarity index 88%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/Effect.h
rename to audio/effect/all-versions/default/Effect.h
index b546e0e..f6a12d9 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/Effect.h
+++ b/audio/effect/all-versions/default/Effect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_EFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_EFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffect.h)
+
+#include "AudioBufferManager.h"
#include <atomic>
#include <memory>
@@ -34,28 +39,28 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioDeviceBitfield;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectFeature;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
+using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
+using ::android::hardware::audio::common::CPP_VERSION::Uuid;
+using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioDeviceBitfield;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectFeature;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct Effect : public IEffect {
typedef MessageQueue<Result, kSynchronizedReadWrite> StatusMQ;
@@ -64,7 +69,7 @@
explicit Effect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -234,8 +239,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_EFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.impl.h b/audio/effect/all-versions/default/EffectsFactory.cpp
similarity index 88%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.impl.h
rename to audio/effect/all-versions/default/EffectsFactory.cpp
index f3256f1..d2d8a46 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.impl.h
+++ b/audio/effect/all-versions/default/EffectsFactory.cpp
@@ -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,25 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "EffectFactoryHAL"
+#include "EffectsFactory.h"
+#include "AcousticEchoCancelerEffect.h"
+#include "AutomaticGainControlEffect.h"
+#include "BassBoostEffect.h"
+#include "Conversions.h"
+#include "DownmixEffect.h"
+#include "Effect.h"
+#include "EnvironmentalReverbEffect.h"
+#include "EqualizerEffect.h"
+#include "HidlUtils.h"
+#include "LoudnessEnhancerEffect.h"
+#include "NoiseSuppressionEffect.h"
+#include "PresetReverbEffect.h"
+#include "VirtualizerEffect.h"
+#include "VisualizerEffect.h"
+#include "common/all-versions/default/EffectMap.h"
+
+using ::android::hardware::audio::common::CPP_VERSION::HidlUtils;
#include <android/log.h>
#include <media/EffectsFactoryApi.h>
@@ -30,13 +48,13 @@
#include <system/audio_effects/effect_virtualizer.h>
#include <system/audio_effects/effect_visualizer.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 effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
// static
@@ -69,7 +87,7 @@
return new Effect(handle);
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectsFactory follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory follow.
Return<void> EffectsFactory::getAllDescriptors(getAllDescriptors_cb _hidl_cb) {
Result retval(Result::OK);
hidl_vec<EffectDescriptor> result;
@@ -189,7 +207,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.h b/audio/effect/all-versions/default/EffectsFactory.h
similarity index 65%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.h
rename to audio/effect/all-versions/default/EffectsFactory.h
index 526abbb8..0cbfaa2 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EffectsFactory.h
+++ b/audio/effect/all-versions/default/EffectsFactory.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,14 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H
+
+#include <system/audio_effect.h>
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffectsFactory.h)
+
+#include <hidl/MQDescriptor.h>
#include <hardware/audio_effect.h>
#include <system/audio_effect.h>
@@ -26,27 +33,28 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::Uuid;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectsFactory;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::Uuid;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct EffectsFactory : public IEffectsFactory {
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectsFactory follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffectsFactory follow.
Return<void> getAllDescriptors(getAllDescriptors_cb _hidl_cb) override;
Return<void> getDescriptor(const Uuid& uid, getDescriptor_cb _hidl_cb) override;
Return<void> createEffect(const Uuid& uid, int32_t session, int32_t ioHandle,
createEffect_cb _hidl_cb) override;
- Return<void> debugDump(const hidl_handle& fd); //< in V2_0::IEffectsFactory only, alias of debug
+ Return<void> debugDump(
+ const hidl_handle& fd); //< in CPP_VERSION::IEffectsFactory only, alias of debug
Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
private:
@@ -57,8 +65,10 @@
extern "C" IEffectsFactory* HIDL_FETCH_IEffectsFactory(const char* name);
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_EFFECTSFACTORY_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.impl.h b/audio/effect/all-versions/default/EnvironmentalReverbEffect.cpp
similarity index 96%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.impl.h
rename to audio/effect/all-versions/default/EnvironmentalReverbEffect.cpp
index 39a4092..1ade7b8 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.impl.h
+++ b/audio/effect/all-versions/default/EnvironmentalReverbEffect.cpp
@@ -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 "EnvReverb_HAL"
+#include <android/log.h>
+
+#include "EnvironmentalReverbEffect.h"
#include <android/log.h>
@@ -24,7 +27,7 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
EnvironmentalReverbEffect::EnvironmentalReverbEffect(effect_handle_t handle)
@@ -60,7 +63,7 @@
halProperties->density = properties.density;
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> EnvironmentalReverbEffect::init() {
return mEffect->init();
}
@@ -190,7 +193,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEnvironmentalReverbEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEnvironmentalReverbEffect
// follow.
Return<Result> EnvironmentalReverbEffect::setBypass(bool bypass) {
return mEffect->setParam(REVERB_PARAM_BYPASS, bypass);
@@ -297,7 +300,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.h b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h
similarity index 80%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.h
rename to audio/effect/all-versions/default/EnvironmentalReverbEffect.h
index d2f8cc3..7e6597b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EnvironmentalReverbEffect.h
+++ b/audio/effect/all-versions/default/EnvironmentalReverbEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,14 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_ENVIRONMENTALREVERBEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_ENVIRONMENTALREVERBEFFECT_H
+
+#include <system/audio_effects/effect_environmentalreverb.h>
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEnvironmentalReverbEffect.h)
+
+#include "Effect.h"
#include <system/audio_effects/effect_environmentalreverb.h>
@@ -28,31 +35,31 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEnvironmentalReverbEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
+using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::CPP_VERSION::IEnvironmentalReverbEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct EnvironmentalReverbEffect : public IEnvironmentalReverbEffect {
explicit EnvironmentalReverbEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -97,7 +104,7 @@
Return<Result> close() override;
// Methods from
- // ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEnvironmentalReverbEffect follow.
+ // ::android::hardware::audio::effect::CPP_VERSION::IEnvironmentalReverbEffect follow.
Return<Result> setBypass(bool bypass) override;
Return<void> getBypass(getBypass_cb _hidl_cb) override;
Return<Result> setRoomLevel(int16_t roomLevel) override;
@@ -136,8 +143,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_ENVIRONMENTALREVERBEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.impl.h b/audio/effect/all-versions/default/EqualizerEffect.cpp
similarity index 96%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.impl.h
rename to audio/effect/all-versions/default/EqualizerEffect.cpp
index db6bed8..f6177b7 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.impl.h
+++ b/audio/effect/all-versions/default/EqualizerEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "Equalizer_HAL"
+
+#include "EqualizerEffect.h"
#include <memory.h>
@@ -26,7 +28,7 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
EqualizerEffect::EqualizerEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
@@ -55,7 +57,7 @@
return halBuffer;
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> EqualizerEffect::init() {
return mEffect->init();
}
@@ -182,7 +184,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEqualizerEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect follow.
Return<void> EqualizerEffect::getNumBands(getNumBands_cb _hidl_cb) {
return mEffect->getIntegerParam(EQ_PARAM_NUM_BANDS, _hidl_cb);
}
@@ -285,7 +287,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.h b/audio/effect/all-versions/default/EqualizerEffect.h
similarity index 79%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.h
rename to audio/effect/all-versions/default/EqualizerEffect.h
index de52052..5e1e2b9 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/EqualizerEffect.h
+++ b/audio/effect/all-versions/default/EqualizerEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_EQUALIZEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_EQUALIZEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEqualizerEffect.h)
+
+#include "Effect.h"
#include <vector>
@@ -30,31 +35,31 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEqualizerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
+using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct EqualizerEffect : public IEqualizerEffect {
explicit EqualizerEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -98,7 +103,7 @@
const hidl_vec<uint8_t>& configData) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEqualizerEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect follow.
Return<void> getNumBands(getNumBands_cb _hidl_cb) override;
Return<void> getLevelRange(getLevelRange_cb _hidl_cb) override;
Return<Result> setBandLevel(uint16_t band, int16_t level) override;
@@ -124,8 +129,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_EQUALIZEREFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.impl.h b/audio/effect/all-versions/default/LoudnessEnhancerEffect.cpp
similarity index 94%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.impl.h
rename to audio/effect/all-versions/default/LoudnessEnhancerEffect.cpp
index 88210e9..6918bdf 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.impl.h
+++ b/audio/effect/all-versions/default/LoudnessEnhancerEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "LoudnessEnhancer_HAL"
+
+#include "LoudnessEnhancerEffect.h"
#include <system/audio_effects/effect_loudnessenhancer.h>
@@ -27,7 +29,7 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
LoudnessEnhancerEffect::LoudnessEnhancerEffect(effect_handle_t handle)
@@ -35,7 +37,7 @@
LoudnessEnhancerEffect::~LoudnessEnhancerEffect() {}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> LoudnessEnhancerEffect::init() {
return mEffect->init();
}
@@ -162,7 +164,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::ILoudnessEnhancerEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect
// follow.
Return<Result> LoudnessEnhancerEffect::setTargetGain(int32_t targetGainMb) {
return mEffect->setParam(LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB, targetGainMb);
@@ -182,7 +184,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.h b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h
similarity index 75%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.h
rename to audio/effect/all-versions/default/LoudnessEnhancerEffect.h
index b59b077..6eb8a8c 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/LoudnessEnhancerEffect.h
+++ b/audio/effect/all-versions/default/LoudnessEnhancerEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_LOUDNESSENHANCEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_LOUDNESSENHANCEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/ILoudnessEnhancerEffect.h)
+
+#include "Effect.h"
#include <hidl/Status.h>
@@ -26,31 +31,31 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::ILoudnessEnhancerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
+using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct LoudnessEnhancerEffect : public ILoudnessEnhancerEffect {
explicit LoudnessEnhancerEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -94,7 +99,7 @@
const hidl_vec<uint8_t>& configData) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::ILoudnessEnhancerEffect
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect
// follow.
Return<Result> setTargetGain(int32_t targetGainMb) override;
Return<void> getTargetGain(getTargetGain_cb _hidl_cb) override;
@@ -106,8 +111,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_LOUDNESSENHANCEREFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.impl.h b/audio/effect/all-versions/default/NoiseSuppressionEffect.cpp
similarity index 95%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.impl.h
rename to audio/effect/all-versions/default/NoiseSuppressionEffect.cpp
index f32399c..4756719 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.impl.h
+++ b/audio/effect/all-versions/default/NoiseSuppressionEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "NS_Effect_HAL"
+
+#include "NoiseSuppressionEffect.h"
#include <android/log.h>
@@ -24,7 +26,7 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
NoiseSuppressionEffect::NoiseSuppressionEffect(effect_handle_t handle)
@@ -44,7 +46,7 @@
halProperties->type = static_cast<uint32_t>(properties.type);
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> NoiseSuppressionEffect::init() {
return mEffect->init();
}
@@ -171,7 +173,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::INoiseSuppressionEffect
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::INoiseSuppressionEffect
// follow.
Return<Result> NoiseSuppressionEffect::setSuppressionLevel(INoiseSuppressionEffect::Level level) {
return mEffect->setParam(NS_PARAM_LEVEL, static_cast<int32_t>(level));
@@ -212,7 +214,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.h b/audio/effect/all-versions/default/NoiseSuppressionEffect.h
similarity index 77%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.h
rename to audio/effect/all-versions/default/NoiseSuppressionEffect.h
index af1635b..af62dd1 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/NoiseSuppressionEffect.h
+++ b/audio/effect/all-versions/default/NoiseSuppressionEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_NOISESUPPRESSIONEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_NOISESUPPRESSIONEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/INoiseSuppressionEffect.h)
+
+#include "Effect.h"
#include <system/audio_effects/effect_ns.h>
@@ -28,31 +33,31 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::INoiseSuppressionEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
+using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::CPP_VERSION::INoiseSuppressionEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct NoiseSuppressionEffect : public INoiseSuppressionEffect {
explicit NoiseSuppressionEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -96,7 +101,7 @@
const hidl_vec<uint8_t>& configData) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::INoiseSuppressionEffect
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::INoiseSuppressionEffect
// follow.
Return<Result> setSuppressionLevel(INoiseSuppressionEffect::Level level) override;
Return<void> getSuppressionLevel(getSuppressionLevel_cb _hidl_cb) override;
@@ -118,8 +123,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_NOISESUPPRESSIONEFFECT_H
diff --git a/audio/effect/all-versions/OWNERS b/audio/effect/all-versions/default/OWNERS
similarity index 100%
rename from audio/effect/all-versions/OWNERS
rename to audio/effect/all-versions/default/OWNERS
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.impl.h b/audio/effect/all-versions/default/PresetReverbEffect.cpp
similarity index 93%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.impl.h
rename to audio/effect/all-versions/default/PresetReverbEffect.cpp
index eab68fb..97723f5 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.impl.h
+++ b/audio/effect/all-versions/default/PresetReverbEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "PresetReverb_HAL"
+
+#include "PresetReverbEffect.h"
#include <android/log.h>
#include <system/audio_effects/effect_presetreverb.h>
@@ -25,14 +27,14 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
PresetReverbEffect::PresetReverbEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
PresetReverbEffect::~PresetReverbEffect() {}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> PresetReverbEffect::init() {
return mEffect->init();
}
@@ -159,7 +161,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IPresetReverbEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IPresetReverbEffect follow.
Return<Result> PresetReverbEffect::setPreset(IPresetReverbEffect::Preset preset) {
return mEffect->setParam(REVERB_PARAM_PRESET, static_cast<t_reverb_presets>(preset));
}
@@ -172,7 +174,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.h b/audio/effect/all-versions/default/PresetReverbEffect.h
similarity index 75%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.h
rename to audio/effect/all-versions/default/PresetReverbEffect.h
index 1a91ab4..aa864b0 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/PresetReverbEffect.h
+++ b/audio/effect/all-versions/default/PresetReverbEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_PRESETREVERBEFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_PRESETREVERBEFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IPresetReverbEffect.h)
+
+#include "Effect.h"
#include <hidl/Status.h>
@@ -26,31 +31,31 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IPresetReverbEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
+using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::CPP_VERSION::IPresetReverbEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct PresetReverbEffect : public IPresetReverbEffect {
explicit PresetReverbEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -94,7 +99,7 @@
const hidl_vec<uint8_t>& configData) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IPresetReverbEffect
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IPresetReverbEffect
// follow.
Return<Result> setPreset(IPresetReverbEffect::Preset preset) override;
Return<void> getPreset(getPreset_cb _hidl_cb) override;
@@ -106,8 +111,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_PRESETREVERBEFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.impl.h b/audio/effect/all-versions/default/VirtualizerEffect.cpp
similarity index 95%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.impl.h
rename to audio/effect/all-versions/default/VirtualizerEffect.cpp
index 23b09a89..4d597c7 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.impl.h
+++ b/audio/effect/all-versions/default/VirtualizerEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "Virtualizer_HAL"
+
+#include "VirtualizerEffect.h"
#include <memory.h>
@@ -27,7 +29,7 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
VirtualizerEffect::VirtualizerEffect(effect_handle_t handle) : mEffect(new Effect(handle)) {}
@@ -44,7 +46,7 @@
}
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> VirtualizerEffect::init() {
return mEffect->init();
}
@@ -171,7 +173,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVirtualizerEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IVirtualizerEffect follow.
Return<bool> VirtualizerEffect::isStrengthSupported() {
bool halSupported = false;
mEffect->getParam(VIRTUALIZER_PARAM_STRENGTH_SUPPORTED, halSupported);
@@ -224,7 +226,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.h b/audio/effect/all-versions/default/VirtualizerEffect.h
similarity index 75%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.h
rename to audio/effect/all-versions/default/VirtualizerEffect.h
index c0d5a00..87b53d6 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/VirtualizerEffect.h
+++ b/audio/effect/all-versions/default/VirtualizerEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VIRTUALIZEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_VIRTUALIZEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IVirtualizerEffect.h)
+
+#include "Effect.h"
#include <hidl/Status.h>
@@ -26,33 +31,33 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::implementation::AudioChannelBitfield;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVirtualizerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::AudioChannelMask;
+using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
+using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
+using ::android::hardware::audio::common::CPP_VERSION::implementation::AudioChannelBitfield;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::CPP_VERSION::IVirtualizerEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct VirtualizerEffect : public IVirtualizerEffect {
explicit VirtualizerEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -96,7 +101,7 @@
const hidl_vec<uint8_t>& configData) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVirtualizerEffect
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IVirtualizerEffect
// follow.
Return<bool> isStrengthSupported() override;
Return<Result> setStrength(uint16_t strength) override;
@@ -116,8 +121,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_VIRTUALIZEREFFECT_H
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.impl.h b/audio/effect/all-versions/default/VisualizerEffect.cpp
similarity index 95%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.impl.h
rename to audio/effect/all-versions/default/VisualizerEffect.cpp
index 9f2195b..77bf46b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.impl.h
+++ b/audio/effect/all-versions/default/VisualizerEffect.cpp
@@ -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,9 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#define LOG_TAG "Visualizer_HAL"
+
+#include "VisualizerEffect.h"
#include <android/log.h>
#include <system/audio_effects/effect_visualizer.h>
@@ -25,7 +27,7 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
VisualizerEffect::VisualizerEffect(effect_handle_t handle)
@@ -33,7 +35,7 @@
VisualizerEffect::~VisualizerEffect() {}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> VisualizerEffect::init() {
return mEffect->init();
}
@@ -160,7 +162,7 @@
return mEffect->close();
}
-// Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVisualizerEffect follow.
+// Methods from ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect follow.
Return<Result> VisualizerEffect::setCaptureSize(uint16_t captureSize) {
Result retval = mEffect->setParam(VISUALIZER_PARAM_CAPTURE_SIZE, captureSize);
if (retval == Result::OK) {
@@ -247,7 +249,7 @@
}
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
diff --git a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.h b/audio/effect/all-versions/default/VisualizerEffect.h
similarity index 77%
rename from audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.h
rename to audio/effect/all-versions/default/VisualizerEffect.h
index 114d3b7..0a13a2b 100644
--- a/audio/effect/all-versions/default/include/effect/all-versions/default/VisualizerEffect.h
+++ b/audio/effect/all-versions/default/VisualizerEffect.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,12 @@
* limitations under the License.
*/
-#include <common/all-versions/IncludeGuard.h>
+#ifndef ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H
+#define ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IVisualizerEffect.h)
+
+#include "Effect.h"
#include <hidl/Status.h>
@@ -26,31 +31,31 @@
namespace hardware {
namespace audio {
namespace effect {
-namespace AUDIO_HAL_VERSION {
+namespace CPP_VERSION {
namespace implementation {
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode;
-using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::AudioBuffer;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectAuxChannelsConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectConfig;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectDescriptor;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::EffectOffloadParameter;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffectBufferProviderCallback;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVisualizerEffect;
-using ::android::hardware::audio::effect::AUDIO_HAL_VERSION::Result;
+using ::android::sp;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::hidl_string;
-using ::android::sp;
+using ::android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using ::android::hardware::audio::common::CPP_VERSION::AudioMode;
+using ::android::hardware::audio::common::CPP_VERSION::AudioSource;
+using ::android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectConfig;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using ::android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::IEffectBufferProviderCallback;
+using ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect;
+using ::android::hardware::audio::effect::CPP_VERSION::Result;
struct VisualizerEffect : public IVisualizerEffect {
explicit VisualizerEffect(effect_handle_t handle);
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
Return<Result> init() override;
Return<Result> setConfig(
const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
@@ -94,7 +99,7 @@
const hidl_vec<uint8_t>& configData) override;
Return<Result> close() override;
- // Methods from ::android::hardware::audio::effect::AUDIO_HAL_VERSION::IVisualizerEffect follow.
+ // Methods from ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect follow.
Return<Result> setCaptureSize(uint16_t captureSize) override;
Return<void> getCaptureSize(getCaptureSize_cb _hidl_cb) override;
Return<Result> setScalingMode(IVisualizerEffect::ScalingMode scalingMode) override;
@@ -115,8 +120,10 @@
};
} // namespace implementation
-} // namespace AUDIO_HAL_VERSION
+} // namespace CPP_VERSION
} // namespace effect
} // namespace audio
} // namespace hardware
} // namespace android
+
+#endif // ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H
diff --git a/audio/core/2.0/vts/OWNERS b/audio/effect/all-versions/vts/OWNERS
similarity index 98%
copy from audio/core/2.0/vts/OWNERS
copy to audio/effect/all-versions/vts/OWNERS
index 8711a9f..0ea4666 100644
--- a/audio/core/2.0/vts/OWNERS
+++ b/audio/effect/all-versions/vts/OWNERS
@@ -2,4 +2,4 @@
krocard@google.com
mnaganov@google.com
yim@google.com
-zhuoyao@google.com
\ No newline at end of file
+zhuoyao@google.com
diff --git a/audio/effect/4.0/vts/functional/Android.bp b/audio/effect/all-versions/vts/functional/Android.bp
similarity index 62%
rename from audio/effect/4.0/vts/functional/Android.bp
rename to audio/effect/all-versions/vts/functional/Android.bp
index 96ded69..0dbcaa5 100644
--- a/audio/effect/4.0/vts/functional/Android.bp
+++ b/audio/effect/all-versions/vts/functional/Android.bp
@@ -14,17 +14,15 @@
// limitations under the License.
//
-cc_test {
- name: "VtsHalAudioEffectV4_0TargetTest",
+cc_defaults {
+ name: "VtsHalAudioEffectTargetTest_default",
defaults: ["VtsHalTargetTestDefaults"],
srcs: [
- "VtsHalAudioEffectV4_0TargetTest.cpp",
+ "VtsHalAudioEffectTargetTest.cpp",
"ValidateAudioEffectsConfiguration.cpp"
],
static_libs: [
"android.hardware.audio.common.test.utility",
- "android.hardware.audio.common@4.0",
- "android.hardware.audio.effect@4.0",
"android.hidl.allocator@1.0",
"android.hidl.memory@1.0",
"libeffectsconfig",
@@ -35,4 +33,33 @@
header_libs: [
"android.hardware.audio.common.util@all-versions",
],
+ test_suites: ["general-tests"],
+}
+
+cc_test {
+ name: "VtsHalAudioEffectV2_0TargetTest",
+ defaults: ["VtsHalAudioEffectTargetTest_default"],
+ static_libs: [
+ "android.hardware.audio.common@2.0",
+ "android.hardware.audio.effect@2.0",
+ ],
+ cflags: [
+ "-DMAJOR_VERSION=2",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
+}
+
+cc_test {
+ name: "VtsHalAudioEffectV4_0TargetTest",
+ defaults: ["VtsHalAudioEffectTargetTest_default"],
+ static_libs: [
+ "android.hardware.audio.common@4.0",
+ "android.hardware.audio.effect@4.0",
+ ],
+ cflags: [
+ "-DMAJOR_VERSION=4",
+ "-DMINOR_VERSION=0",
+ "-include common/all-versions/VersionMacro.h",
+ ]
}
diff --git a/audio/effect/4.0/vts/functional/ValidateAudioEffectsConfiguration.cpp b/audio/effect/all-versions/vts/functional/ValidateAudioEffectsConfiguration.cpp
similarity index 68%
rename from audio/effect/4.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
rename to audio/effect/all-versions/vts/functional/ValidateAudioEffectsConfiguration.cpp
index 6338563..9f45ce2 100644
--- a/audio/effect/4.0/vts/functional/ValidateAudioEffectsConfiguration.cpp
+++ b/audio/effect/all-versions/vts/functional/ValidateAudioEffectsConfiguration.cpp
@@ -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.
@@ -21,12 +21,22 @@
#include "utility/ValidateXml.h"
+// Stringify the argument.
+#define QUOTE(x) #x
+#define STRINGIFY(x) QUOTE(x)
+
TEST(CheckConfig, audioEffectsConfigurationValidation) {
RecordProperty("description",
"Verify that the effects configuration file is valid according to the schema");
using namespace android::effectsConfig;
std::vector<const char*> locations(std::begin(DEFAULT_LOCATIONS), std::end(DEFAULT_LOCATIONS));
- EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations,
- "/data/local/tmp/audio_effects_conf_V4_0.xsd");
+ const char* xsd = "/data/local/tmp/audio_effects_conf_" STRINGIFY(CPP_VERSION) ".xsd";
+#if MAJOR_VERSION == 2
+ // In V2, audio effect XML is not required. .conf is still allowed though deprecated
+ EXPECT_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, xsd);
+#elif MAJOR_VERSION == 4
+ // Starting with V4, audio effect XML is required
+ EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(DEFAULT_NAME, locations, xsd);
+#endif
}
diff --git a/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp
new file mode 100644
index 0000000..c248eae
--- /dev/null
+++ b/audio/effect/all-versions/vts/functional/VtsHalAudioEffectTargetTest.cpp
@@ -0,0 +1,832 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AudioEffectHidlHalTest"
+#include <android-base/logging.h>
+#include <system/audio.h>
+
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffect.h)
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEffectsFactory.h)
+#include PATH(android/hardware/audio/effect/FILE_VERSION/IEqualizerEffect.h)
+#include PATH(android/hardware/audio/effect/FILE_VERSION/ILoudnessEnhancerEffect.h)
+#include PATH(android/hardware/audio/effect/FILE_VERSION/types.h)
+#include <android/hidl/allocator/1.0/IAllocator.h>
+#include <android/hidl/memory/1.0/IMemory.h>
+
+#include <common/all-versions/VersionUtils.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+
+using android::sp;
+using android::hardware::hidl_handle;
+using android::hardware::hidl_memory;
+using android::hardware::hidl_string;
+using android::hardware::hidl_vec;
+using android::hardware::MQDescriptorSync;
+using android::hardware::Return;
+using android::hardware::Void;
+using android::hardware::audio::common::CPP_VERSION::AudioDevice;
+using android::hardware::audio::common::CPP_VERSION::AudioHandleConsts;
+using android::hardware::audio::common::CPP_VERSION::AudioMode;
+using android::hardware::audio::common::CPP_VERSION::AudioSource;
+using android::hardware::audio::common::CPP_VERSION::Uuid;
+using android::hardware::audio::common::utils::mkEnumBitfield;
+using android::hardware::audio::effect::CPP_VERSION::AudioBuffer;
+using android::hardware::audio::effect::CPP_VERSION::EffectAuxChannelsConfig;
+using android::hardware::audio::effect::CPP_VERSION::EffectBufferConfig;
+using android::hardware::audio::effect::CPP_VERSION::EffectConfig;
+using android::hardware::audio::effect::CPP_VERSION::EffectDescriptor;
+using android::hardware::audio::effect::CPP_VERSION::EffectOffloadParameter;
+using android::hardware::audio::effect::CPP_VERSION::IEffect;
+using android::hardware::audio::effect::CPP_VERSION::IEffectsFactory;
+using android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect;
+using android::hardware::audio::effect::CPP_VERSION::ILoudnessEnhancerEffect;
+using android::hardware::audio::effect::CPP_VERSION::Result;
+using android::hidl::allocator::V1_0::IAllocator;
+using android::hidl::memory::V1_0::IMemory;
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
+#endif
+
+// Test environment for Audio Effects Factory HIDL HAL.
+class AudioEffectsFactoryHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static AudioEffectsFactoryHidlEnvironment* Instance() {
+ static AudioEffectsFactoryHidlEnvironment* instance =
+ new AudioEffectsFactoryHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IEffectsFactory>(); }
+};
+
+// The main test class for Audio Effects Factory HIDL HAL.
+class AudioEffectsFactoryHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ void SetUp() override {
+ effectsFactory = ::testing::VtsHalHidlTargetTestBase::getService<IEffectsFactory>(
+ AudioEffectsFactoryHidlEnvironment::Instance()->getServiceName<IEffectsFactory>());
+ ASSERT_NE(effectsFactory, nullptr);
+ }
+
+ void TearDown() override { effectsFactory.clear(); }
+
+ protected:
+ static void description(const std::string& description) {
+ RecordProperty("description", description);
+ }
+
+ sp<IEffectsFactory> effectsFactory;
+};
+
+TEST_F(AudioEffectsFactoryHidlTest, EnumerateEffects) {
+ description("Verify that EnumerateEffects returns at least one effect");
+ Result retval = Result::NOT_INITIALIZED;
+ size_t effectCount = 0;
+ Return<void> ret =
+ effectsFactory->getAllDescriptors([&](Result r, const hidl_vec<EffectDescriptor>& result) {
+ retval = r;
+ effectCount = result.size();
+ });
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ EXPECT_GT(effectCount, 0u);
+}
+
+TEST_F(AudioEffectsFactoryHidlTest, CreateEffect) {
+ description("Verify that an effect can be created via CreateEffect");
+ bool gotEffect = false;
+ Uuid effectUuid;
+ Return<void> ret =
+ effectsFactory->getAllDescriptors([&](Result r, const hidl_vec<EffectDescriptor>& result) {
+ if (r == Result::OK && result.size() > 0) {
+ gotEffect = true;
+ effectUuid = result[0].uuid;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_TRUE(gotEffect);
+ Result retval = Result::NOT_INITIALIZED;
+ sp<IEffect> effect;
+ ret = effectsFactory->createEffect(
+ effectUuid, 1 /*session*/, 1 /*ioHandle*/,
+ [&](Result r, const sp<IEffect>& result, uint64_t /*effectId*/) {
+ retval = r;
+ if (r == Result::OK) {
+ effect = result;
+ }
+ });
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ EXPECT_NE(nullptr, effect.get());
+}
+
+TEST_F(AudioEffectsFactoryHidlTest, GetDescriptor) {
+ description(
+ "Verify that effects factory can provide an effect descriptor via "
+ "GetDescriptor");
+ hidl_vec<EffectDescriptor> allDescriptors;
+ Return<void> ret =
+ effectsFactory->getAllDescriptors([&](Result r, const hidl_vec<EffectDescriptor>& result) {
+ if (r == Result::OK) {
+ allDescriptors = result;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_GT(allDescriptors.size(), 0u);
+ for (size_t i = 0; i < allDescriptors.size(); ++i) {
+ ret = effectsFactory->getDescriptor(allDescriptors[i].uuid,
+ [&](Result r, const EffectDescriptor& result) {
+ EXPECT_EQ(r, Result::OK);
+ EXPECT_EQ(result, allDescriptors[i]);
+ });
+ }
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectsFactoryHidlTest, DebugDumpInvalidArgument) {
+ description("Verify that debugDump doesn't crash on invalid arguments");
+#if MAJOR_VERSION == 2
+ Return<void> ret = effectsFactory->debugDump(hidl_handle());
+#elif MAJOR_VERSION == 4
+ Return<void> ret = effectsFactory->debug(hidl_handle(), {});
+#endif
+ ASSERT_TRUE(ret.isOk());
+}
+
+// Equalizer effect is required by CDD, but only the type is fixed.
+// This is the same UUID as AudioEffect.EFFECT_TYPE_EQUALIZER in Java.
+static const Uuid EQUALIZER_EFFECT_TYPE = {
+ 0x0bed4300, 0xddd6, 0x11db, 0x8f34,
+ std::array<uint8_t, 6>{{0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}};
+// Loudness Enhancer effect is required by CDD, but only the type is fixed.
+// This is the same UUID as AudioEffect.EFFECT_TYPE_LOUDNESS_ENHANCER in Java.
+static const Uuid LOUDNESS_ENHANCER_EFFECT_TYPE = {
+ 0xfe3199be, 0xaed0, 0x413f, 0x87bb,
+ std::array<uint8_t, 6>{{0x11, 0x26, 0x0e, 0xb6, 0x3c, 0xf1}}};
+
+// The main test class for Audio Effect HIDL HAL.
+class AudioEffectHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ void SetUp() override {
+ effectsFactory = ::testing::VtsHalHidlTargetTestBase::getService<IEffectsFactory>();
+ ASSERT_NE(nullptr, effectsFactory.get());
+
+ findAndCreateEffect(getEffectType());
+ ASSERT_NE(nullptr, effect.get());
+
+ Return<Result> ret = effect->init();
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Result::OK, ret);
+ }
+
+ void TearDown() override {
+ effect.clear();
+ effectsFactory.clear();
+ }
+
+ protected:
+ static void description(const std::string& description) {
+ RecordProperty("description", description);
+ }
+
+ virtual Uuid getEffectType() { return EQUALIZER_EFFECT_TYPE; }
+
+ void findAndCreateEffect(const Uuid& type);
+ void findEffectInstance(const Uuid& type, Uuid* uuid);
+ void getChannelCount(uint32_t* channelCount);
+
+ sp<IEffectsFactory> effectsFactory;
+ sp<IEffect> effect;
+};
+
+void AudioEffectHidlTest::findAndCreateEffect(const Uuid& type) {
+ Uuid effectUuid;
+ findEffectInstance(type, &effectUuid);
+ Return<void> ret = effectsFactory->createEffect(
+ effectUuid, 1 /*session*/, 1 /*ioHandle*/,
+ [&](Result r, const sp<IEffect>& result, uint64_t /*effectId*/) {
+ if (r == Result::OK) {
+ effect = result;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+}
+
+void AudioEffectHidlTest::findEffectInstance(const Uuid& type, Uuid* uuid) {
+ bool effectFound = false;
+ Return<void> ret =
+ effectsFactory->getAllDescriptors([&](Result r, const hidl_vec<EffectDescriptor>& result) {
+ if (r == Result::OK) {
+ for (const auto& desc : result) {
+ if (desc.type == type) {
+ effectFound = true;
+ *uuid = desc.uuid;
+ break;
+ }
+ }
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_TRUE(effectFound);
+}
+
+void AudioEffectHidlTest::getChannelCount(uint32_t* channelCount) {
+ Result retval;
+ EffectConfig currentConfig;
+ Return<void> ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
+ retval = r;
+ if (r == Result::OK) {
+ currentConfig = conf;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Result::OK, retval);
+ ASSERT_TRUE(audio_channel_mask_is_valid(
+ static_cast<audio_channel_mask_t>(currentConfig.outputCfg.channels)));
+ *channelCount = audio_channel_count_from_out_mask(
+ static_cast<audio_channel_mask_t>(currentConfig.outputCfg.channels));
+}
+
+TEST_F(AudioEffectHidlTest, Close) {
+ description("Verify that an effect can be closed");
+ Return<Result> ret = effect->close();
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+}
+
+TEST_F(AudioEffectHidlTest, GetDescriptor) {
+ description("Verify that an effect can return its own descriptor via GetDescriptor");
+ Result retval = Result::NOT_INITIALIZED;
+ Uuid actualType;
+ Return<void> ret = effect->getDescriptor([&](Result r, const EffectDescriptor& desc) {
+ retval = r;
+ if (r == Result::OK) {
+ actualType = desc.type;
+ }
+ });
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ EXPECT_EQ(getEffectType(), actualType);
+}
+
+TEST_F(AudioEffectHidlTest, GetSetConfig) {
+ description(
+ "Verify that it is possible to manipulate effect config via Get / "
+ "SetConfig");
+ Result retval = Result::NOT_INITIALIZED;
+ EffectConfig currentConfig;
+ Return<void> ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
+ retval = r;
+ if (r == Result::OK) {
+ currentConfig = conf;
+ }
+ });
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ Return<Result> ret2 = effect->setConfig(currentConfig, nullptr, nullptr);
+ EXPECT_TRUE(ret2.isOk());
+ EXPECT_EQ(Result::OK, ret2);
+}
+
+TEST_F(AudioEffectHidlTest, GetConfigReverse) {
+ description("Verify that GetConfigReverse does not crash");
+ Return<void> ret = effect->getConfigReverse([&](Result, const EffectConfig&) {});
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetSupportedAuxChannelsConfigs) {
+ description("Verify that GetSupportedAuxChannelsConfigs does not crash");
+ Return<void> ret = effect->getSupportedAuxChannelsConfigs(
+ 0, [&](Result, const hidl_vec<EffectAuxChannelsConfig>&) {});
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetAuxChannelsConfig) {
+ description("Verify that GetAuxChannelsConfig does not crash");
+ Return<void> ret = effect->getAuxChannelsConfig([&](Result, const EffectAuxChannelsConfig&) {});
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, SetAuxChannelsConfig) {
+ description("Verify that SetAuxChannelsConfig does not crash");
+ Return<Result> ret = effect->setAuxChannelsConfig(EffectAuxChannelsConfig());
+ EXPECT_TRUE(ret.isOk());
+}
+
+// Not generated automatically because AudioBuffer contains
+// instances of hidl_memory which can't be compared properly
+// in general case due to presence of handles.
+//
+// However, in this particular case, handles must not present
+// thus comparison is possible.
+//
+// operator== must be defined in the same namespace as the structures.
+namespace android {
+namespace hardware {
+namespace audio {
+namespace effect {
+namespace CPP_VERSION {
+inline bool operator==(const AudioBuffer& lhs, const AudioBuffer& rhs) {
+ return lhs.id == rhs.id && lhs.frameCount == rhs.frameCount && lhs.data.handle() == nullptr &&
+ rhs.data.handle() == nullptr;
+}
+
+inline bool operator==(const EffectBufferConfig& lhs, const EffectBufferConfig& rhs) {
+ return lhs.buffer == rhs.buffer && lhs.samplingRateHz == rhs.samplingRateHz &&
+ lhs.channels == rhs.channels && lhs.format == rhs.format &&
+ lhs.accessMode == rhs.accessMode && lhs.mask == rhs.mask;
+}
+
+inline bool operator==(const EffectConfig& lhs, const EffectConfig& rhs) {
+ return lhs.inputCfg == rhs.inputCfg && lhs.outputCfg == rhs.outputCfg;
+}
+} // namespace CPP_VERSION
+} // namespace effect
+} // namespace audio
+} // namespace hardware
+} // namespace android
+
+TEST_F(AudioEffectHidlTest, Reset) {
+ description("Verify that Reset preserves effect configuration");
+ Result retval = Result::NOT_INITIALIZED;
+ EffectConfig originalConfig;
+ Return<void> ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
+ retval = r;
+ if (r == Result::OK) {
+ originalConfig = conf;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Result::OK, retval);
+ Return<Result> ret2 = effect->reset();
+ EXPECT_TRUE(ret2.isOk());
+ EXPECT_EQ(Result::OK, ret2);
+ EffectConfig configAfterReset;
+ ret = effect->getConfig([&](Result r, const EffectConfig& conf) {
+ retval = r;
+ if (r == Result::OK) {
+ configAfterReset = conf;
+ }
+ });
+ EXPECT_EQ(originalConfig, configAfterReset);
+}
+
+TEST_F(AudioEffectHidlTest, DisableEnableDisable) {
+ description("Verify Disable -> Enable -> Disable sequence for an effect");
+ Return<Result> ret = effect->disable();
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::INVALID_ARGUMENTS, ret);
+ ret = effect->enable();
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+ ret = effect->disable();
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+}
+
+TEST_F(AudioEffectHidlTest, SetDevice) {
+ description("Verify that SetDevice works for an output chain effect");
+ Return<Result> ret = effect->setDevice(mkEnumBitfield(AudioDevice::OUT_SPEAKER));
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+}
+
+TEST_F(AudioEffectHidlTest, SetAndGetVolume) {
+ description("Verify that SetAndGetVolume method works for an effect");
+ uint32_t channelCount;
+ getChannelCount(&channelCount);
+ hidl_vec<uint32_t> volumes;
+ volumes.resize(channelCount);
+ for (uint32_t i = 0; i < channelCount; ++i) {
+ volumes[i] = 0;
+ }
+ Result retval = Result::NOT_INITIALIZED;
+ Return<void> ret =
+ effect->setAndGetVolume(volumes, [&](Result r, const hidl_vec<uint32_t>&) { retval = r; });
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, retval);
+}
+
+TEST_F(AudioEffectHidlTest, VolumeChangeNotification) {
+ description("Verify that effect accepts VolumeChangeNotification");
+ uint32_t channelCount;
+ getChannelCount(&channelCount);
+ hidl_vec<uint32_t> volumes;
+ volumes.resize(channelCount);
+ for (uint32_t i = 0; i < channelCount; ++i) {
+ volumes[i] = 0;
+ }
+ Return<Result> ret = effect->volumeChangeNotification(volumes);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+}
+
+TEST_F(AudioEffectHidlTest, SetAudioMode) {
+ description("Verify that SetAudioMode works for an effect");
+ Return<Result> ret = effect->setAudioMode(AudioMode::NORMAL);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+}
+
+TEST_F(AudioEffectHidlTest, SetConfigReverse) {
+ description("Verify that SetConfigReverse does not crash");
+ Return<Result> ret = effect->setConfigReverse(EffectConfig(), nullptr, nullptr);
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, SetInputDevice) {
+ description("Verify that SetInputDevice does not crash");
+ Return<Result> ret = effect->setInputDevice(mkEnumBitfield(AudioDevice::IN_BUILTIN_MIC));
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, SetAudioSource) {
+ description("Verify that SetAudioSource does not crash");
+ Return<Result> ret = effect->setAudioSource(AudioSource::MIC);
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, Offload) {
+ description("Verify that calling Offload method does not crash");
+ EffectOffloadParameter offloadParam;
+ offloadParam.isOffload = false;
+ offloadParam.ioHandle = static_cast<int>(AudioHandleConsts::AUDIO_IO_HANDLE_NONE);
+ Return<Result> ret = effect->offload(offloadParam);
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, PrepareForProcessing) {
+ description("Verify that PrepareForProcessing method works for an effect");
+ Result retval = Result::NOT_INITIALIZED;
+ Return<void> ret = effect->prepareForProcessing(
+ [&](Result r, const MQDescriptorSync<Result>&) { retval = r; });
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, retval);
+}
+
+TEST_F(AudioEffectHidlTest, SetProcessBuffers) {
+ description("Verify that SetProcessBuffers works for an effect");
+ sp<IAllocator> ashmem = IAllocator::getService("ashmem");
+ ASSERT_NE(nullptr, ashmem.get());
+ bool success = false;
+ AudioBuffer buffer;
+ Return<void> ret = ashmem->allocate(1024, [&](bool s, const hidl_memory& memory) {
+ success = s;
+ if (s) {
+ buffer.data = memory;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_TRUE(success);
+ Return<Result> ret2 = effect->setProcessBuffers(buffer, buffer);
+ EXPECT_TRUE(ret2.isOk());
+ EXPECT_EQ(Result::OK, ret2);
+}
+
+TEST_F(AudioEffectHidlTest, Command) {
+ description("Verify that Command does not crash");
+ Return<void> ret =
+ effect->command(0, hidl_vec<uint8_t>(), 0, [&](int32_t, const hidl_vec<uint8_t>&) {});
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, SetParameter) {
+ description("Verify that SetParameter does not crash");
+ Return<Result> ret = effect->setParameter(hidl_vec<uint8_t>(), hidl_vec<uint8_t>());
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetParameter) {
+ description("Verify that GetParameter does not crash");
+ Return<void> ret =
+ effect->getParameter(hidl_vec<uint8_t>(), 0, [&](Result, const hidl_vec<uint8_t>&) {});
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetSupportedConfigsForFeature) {
+ description("Verify that GetSupportedConfigsForFeature does not crash");
+ Return<void> ret = effect->getSupportedConfigsForFeature(
+ 0, 0, 0, [&](Result, uint32_t, const hidl_vec<uint8_t>&) {});
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, GetCurrentConfigForFeature) {
+ description("Verify that GetCurrentConfigForFeature does not crash");
+ Return<void> ret =
+ effect->getCurrentConfigForFeature(0, 0, [&](Result, const hidl_vec<uint8_t>&) {});
+ EXPECT_TRUE(ret.isOk());
+}
+
+TEST_F(AudioEffectHidlTest, SetCurrentConfigForFeature) {
+ description("Verify that SetCurrentConfigForFeature does not crash");
+ Return<Result> ret = effect->setCurrentConfigForFeature(0, hidl_vec<uint8_t>());
+ EXPECT_TRUE(ret.isOk());
+}
+
+// The main test class for Equalizer Audio Effect HIDL HAL.
+class EqualizerAudioEffectHidlTest : public AudioEffectHidlTest {
+ public:
+ void SetUp() override {
+ AudioEffectHidlTest::SetUp();
+ equalizer = IEqualizerEffect::castFrom(effect);
+ ASSERT_NE(nullptr, equalizer.get());
+ }
+
+ protected:
+ Uuid getEffectType() override { return EQUALIZER_EFFECT_TYPE; }
+ void getNumBands(uint16_t* numBands);
+ void getLevelRange(int16_t* minLevel, int16_t* maxLevel);
+ void getBandFrequencyRange(uint16_t band, uint32_t* minFreq, uint32_t* centerFreq,
+ uint32_t* maxFreq);
+ void getPresetCount(size_t* count);
+
+ sp<IEqualizerEffect> equalizer;
+};
+
+void EqualizerAudioEffectHidlTest::getNumBands(uint16_t* numBands) {
+ Result retval = Result::NOT_INITIALIZED;
+ Return<void> ret = equalizer->getNumBands([&](Result r, uint16_t b) {
+ retval = r;
+ if (retval == Result::OK) {
+ *numBands = b;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Result::OK, retval);
+}
+
+void EqualizerAudioEffectHidlTest::getLevelRange(int16_t* minLevel, int16_t* maxLevel) {
+ Result retval = Result::NOT_INITIALIZED;
+ Return<void> ret = equalizer->getLevelRange([&](Result r, int16_t min, int16_t max) {
+ retval = r;
+ if (retval == Result::OK) {
+ *minLevel = min;
+ *maxLevel = max;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Result::OK, retval);
+}
+
+void EqualizerAudioEffectHidlTest::getBandFrequencyRange(uint16_t band, uint32_t* minFreq,
+ uint32_t* centerFreq, uint32_t* maxFreq) {
+ Result retval = Result::NOT_INITIALIZED;
+ Return<void> ret =
+ equalizer->getBandFrequencyRange(band, [&](Result r, uint32_t min, uint32_t max) {
+ retval = r;
+ if (retval == Result::OK) {
+ *minFreq = min;
+ *maxFreq = max;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Result::OK, retval);
+ ret = equalizer->getBandCenterFrequency(band, [&](Result r, uint32_t center) {
+ retval = r;
+ if (retval == Result::OK) {
+ *centerFreq = center;
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Result::OK, retval);
+}
+
+void EqualizerAudioEffectHidlTest::getPresetCount(size_t* count) {
+ Result retval = Result::NOT_INITIALIZED;
+ Return<void> ret = equalizer->getPresetNames([&](Result r, const hidl_vec<hidl_string>& names) {
+ retval = r;
+ if (retval == Result::OK) {
+ *count = names.size();
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Result::OK, retval);
+}
+
+TEST_F(EqualizerAudioEffectHidlTest, GetNumBands) {
+ description("Verify that Equalizer effect reports at least one band");
+ uint16_t numBands = 0;
+ getNumBands(&numBands);
+ EXPECT_GT(numBands, 0);
+}
+
+TEST_F(EqualizerAudioEffectHidlTest, GetLevelRange) {
+ description("Verify that Equalizer effect reports adequate band level range");
+ int16_t minLevel = 0x7fff, maxLevel = 0;
+ getLevelRange(&minLevel, &maxLevel);
+ EXPECT_GT(maxLevel, minLevel);
+}
+
+TEST_F(EqualizerAudioEffectHidlTest, GetSetBandLevel) {
+ description("Verify that manipulating band levels works for Equalizer effect");
+ uint16_t numBands = 0;
+ getNumBands(&numBands);
+ ASSERT_GT(numBands, 0);
+ int16_t levels[3]{0x7fff, 0, 0};
+ getLevelRange(&levels[0], &levels[2]);
+ ASSERT_GT(levels[2], levels[0]);
+ levels[1] = (levels[2] + levels[0]) / 2;
+ for (uint16_t i = 0; i < numBands; ++i) {
+ for (size_t j = 0; j < ARRAY_SIZE(levels); ++j) {
+ Return<Result> ret = equalizer->setBandLevel(i, levels[j]);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+ Result retval = Result::NOT_INITIALIZED;
+ int16_t actualLevel;
+ Return<void> ret2 = equalizer->getBandLevel(i, [&](Result r, int16_t l) {
+ retval = r;
+ if (retval == Result::OK) {
+ actualLevel = l;
+ }
+ });
+ EXPECT_TRUE(ret2.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ EXPECT_EQ(levels[j], actualLevel);
+ }
+ }
+}
+
+TEST_F(EqualizerAudioEffectHidlTest, GetBandCenterFrequencyAndRange) {
+ description("Verify that Equalizer effect reports adequate band frequency range");
+ uint16_t numBands = 0;
+ getNumBands(&numBands);
+ ASSERT_GT(numBands, 0);
+ for (uint16_t i = 0; i < numBands; ++i) {
+ uint32_t minFreq = 0xffffffff, centerFreq = 0xffffffff, maxFreq = 0xffffffff;
+ getBandFrequencyRange(i, &minFreq, ¢erFreq, &maxFreq);
+ // Note: NXP legacy implementation reports "1" as upper bound for last band,
+ // so this check fails.
+ EXPECT_GE(maxFreq, centerFreq);
+ EXPECT_GE(centerFreq, minFreq);
+ }
+}
+
+TEST_F(EqualizerAudioEffectHidlTest, GetBandForFrequency) {
+ description("Verify that Equalizer effect supports GetBandForFrequency correctly");
+ uint16_t numBands = 0;
+ getNumBands(&numBands);
+ ASSERT_GT(numBands, 0);
+ for (uint16_t i = 0; i < numBands; ++i) {
+ uint32_t freqs[3]{0, 0, 0};
+ getBandFrequencyRange(i, &freqs[0], &freqs[1], &freqs[2]);
+ // NXP legacy implementation reports "1" as upper bound for last band, some
+ // of the checks fail.
+ for (size_t j = 0; j < ARRAY_SIZE(freqs); ++j) {
+ if (j == 0) {
+ freqs[j]++;
+ } // Min frequency is an open interval.
+ Result retval = Result::NOT_INITIALIZED;
+ uint16_t actualBand = numBands + 1;
+ Return<void> ret = equalizer->getBandForFrequency(freqs[j], [&](Result r, uint16_t b) {
+ retval = r;
+ if (retval == Result::OK) {
+ actualBand = b;
+ }
+ });
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ EXPECT_EQ(i, actualBand) << "Frequency: " << freqs[j];
+ }
+ }
+}
+
+TEST_F(EqualizerAudioEffectHidlTest, GetPresetNames) {
+ description("Verify that Equalizer effect reports at least one preset");
+ size_t presetCount;
+ getPresetCount(&presetCount);
+ EXPECT_GT(presetCount, 0u);
+}
+
+TEST_F(EqualizerAudioEffectHidlTest, GetSetCurrentPreset) {
+ description("Verify that manipulating the current preset for Equalizer effect");
+ size_t presetCount;
+ getPresetCount(&presetCount);
+ ASSERT_GT(presetCount, 0u);
+ for (uint16_t i = 0; i < presetCount; ++i) {
+ Return<Result> ret = equalizer->setCurrentPreset(i);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+ Result retval = Result::NOT_INITIALIZED;
+ uint16_t actualPreset = 0xffff;
+ Return<void> ret2 = equalizer->getCurrentPreset([&](Result r, uint16_t p) {
+ retval = r;
+ if (retval == Result::OK) {
+ actualPreset = p;
+ }
+ });
+ EXPECT_TRUE(ret2.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ EXPECT_EQ(i, actualPreset);
+ }
+}
+
+TEST_F(EqualizerAudioEffectHidlTest, GetSetAllProperties) {
+ description(
+ "Verify that setting band levels and presets works via Get / "
+ "SetAllProperties for Equalizer effect");
+ using AllProperties =
+ android::hardware::audio::effect::CPP_VERSION::IEqualizerEffect::AllProperties;
+ uint16_t numBands = 0;
+ getNumBands(&numBands);
+ ASSERT_GT(numBands, 0);
+ AllProperties props;
+ props.bandLevels.resize(numBands);
+ for (size_t i = 0; i < numBands; ++i) {
+ props.bandLevels[i] = 0;
+ }
+
+ AllProperties actualProps;
+ Result retval = Result::NOT_INITIALIZED;
+
+ // Verify setting of the band levels via properties.
+ props.curPreset = -1;
+ Return<Result> ret = equalizer->setAllProperties(props);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+ Return<void> ret2 = equalizer->getAllProperties([&](Result r, AllProperties p) {
+ retval = r;
+ if (retval == Result::OK) {
+ actualProps = p;
+ }
+ });
+ EXPECT_TRUE(ret2.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ EXPECT_EQ(props.bandLevels, actualProps.bandLevels);
+
+ // Verify setting of the current preset via properties.
+ props.curPreset = 0; // Assuming there is at least one preset.
+ ret = equalizer->setAllProperties(props);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+ ret2 = equalizer->getAllProperties([&](Result r, AllProperties p) {
+ retval = r;
+ if (retval == Result::OK) {
+ actualProps = p;
+ }
+ });
+ EXPECT_TRUE(ret2.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ EXPECT_EQ(props.curPreset, actualProps.curPreset);
+}
+
+// The main test class for Equalizer Audio Effect HIDL HAL.
+class LoudnessEnhancerAudioEffectHidlTest : public AudioEffectHidlTest {
+ public:
+ void SetUp() override {
+ AudioEffectHidlTest::SetUp();
+ enhancer = ILoudnessEnhancerEffect::castFrom(effect);
+ ASSERT_NE(nullptr, enhancer.get());
+ }
+
+ protected:
+ Uuid getEffectType() override { return LOUDNESS_ENHANCER_EFFECT_TYPE; }
+
+ sp<ILoudnessEnhancerEffect> enhancer;
+};
+
+TEST_F(LoudnessEnhancerAudioEffectHidlTest, GetSetTargetGain) {
+ description(
+ "Verify that manipulating the target gain works for Loudness Enhancer "
+ "effect");
+ const int32_t gain = 100;
+ Return<Result> ret = enhancer->setTargetGain(gain);
+ EXPECT_TRUE(ret.isOk());
+ EXPECT_EQ(Result::OK, ret);
+ int32_t actualGain = 0;
+ Result retval;
+ Return<void> ret2 = enhancer->getTargetGain([&](Result r, int32_t g) {
+ retval = r;
+ if (retval == Result::OK) {
+ actualGain = g;
+ }
+ });
+ EXPECT_TRUE(ret2.isOk());
+ EXPECT_EQ(Result::OK, retval);
+ EXPECT_EQ(gain, actualGain);
+}
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(AudioEffectsFactoryHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ AudioEffectsFactoryHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/authsecret/1.0/vts/functional/Android.bp b/authsecret/1.0/vts/functional/Android.bp
index de9f560..f2b3a8a 100644
--- a/authsecret/1.0/vts/functional/Android.bp
+++ b/authsecret/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalAuthSecretV1_0TargetTest.cpp"],
static_libs: ["android.hardware.authsecret@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/automotive/audiocontrol/1.0/vts/functional/Android.bp b/automotive/audiocontrol/1.0/vts/functional/Android.bp
index c6e0d8e..3cb6340 100644
--- a/automotive/audiocontrol/1.0/vts/functional/Android.bp
+++ b/automotive/audiocontrol/1.0/vts/functional/Android.bp
@@ -16,16 +16,14 @@
cc_test {
name: "VtsHalAudioControlV1_0TargetTest",
-
srcs: [
"VtsHalAudioControlV1_0TargetTest.cpp",
],
-
defaults: [
"VtsHalTargetTestDefaults",
],
-
static_libs: [
"android.hardware.automotive.audiocontrol@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/automotive/evs/1.0/vts/functional/Android.bp b/automotive/evs/1.0/vts/functional/Android.bp
index 5d696fc..2ef33fd 100644
--- a/automotive/evs/1.0/vts/functional/Android.bp
+++ b/automotive/evs/1.0/vts/functional/Android.bp
@@ -16,21 +16,17 @@
cc_test {
name: "VtsHalEvsV1_0TargetTest",
-
srcs: [
"VtsHalEvsV1_0TargetTest.cpp",
"FrameHandler.cpp",
"FormatConvert.cpp"
],
-
defaults: ["VtsHalTargetTestDefaults"],
-
shared_libs: [
"libui",
],
-
static_libs: ["android.hardware.automotive.evs@1.0"],
-
+ test_suites: ["general-tests"],
cflags: [
"-O0",
"-g",
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index 7802ef0..a11d452 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -95,6 +95,7 @@
"tests/VmsUtils_test.cpp",
],
header_libs: ["libbase_headers"],
+ test_suites: ["general-tests"],
}
cc_binary {
diff --git a/biometrics/fingerprint/2.1/vts/functional/Android.bp b/biometrics/fingerprint/2.1/vts/functional/Android.bp
index bee3657..60228f2 100644
--- a/biometrics/fingerprint/2.1/vts/functional/Android.bp
+++ b/biometrics/fingerprint/2.1/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalBiometricsFingerprintV2_1TargetTest.cpp"],
static_libs: ["android.hardware.biometrics.fingerprint@2.1"],
+ test_suites: ["general-tests"],
}
diff --git a/bluetooth/1.0/default/Android.bp b/bluetooth/1.0/default/Android.bp
index 48bbadf..f4b1e7b 100644
--- a/bluetooth/1.0/default/Android.bp
+++ b/bluetooth/1.0/default/Android.bp
@@ -94,6 +94,7 @@
"android.hardware.bluetooth-hci",
"libgmock",
],
+ test_suites: ["general-tests"],
}
cc_test_host {
diff --git a/bluetooth/1.0/vts/functional/Android.bp b/bluetooth/1.0/vts/functional/Android.bp
index 2e60588..54039e5 100644
--- a/bluetooth/1.0/vts/functional/Android.bp
+++ b/bluetooth/1.0/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.bluetooth@1.0",
"libbluetooth-types",
],
+ test_suites: ["general-tests"],
}
diff --git a/bluetooth/a2dp/1.0/vts/functional/Android.bp b/bluetooth/a2dp/1.0/vts/functional/Android.bp
index f1ffc45..e50e167 100644
--- a/bluetooth/a2dp/1.0/vts/functional/Android.bp
+++ b/bluetooth/a2dp/1.0/vts/functional/Android.bp
@@ -23,4 +23,5 @@
"android.hardware.bluetooth.a2dp@1.0",
"libbluetooth-types",
],
+ test_suites: ["general-tests"],
}
diff --git a/boot/1.0/vts/functional/Android.bp b/boot/1.0/vts/functional/Android.bp
index 2ef89f3..5d1a9cb 100644
--- a/boot/1.0/vts/functional/Android.bp
+++ b/boot/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalBootV1_0TargetTest.cpp"],
static_libs: ["android.hardware.boot@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/broadcastradio/1.0/vts/functional/Android.bp b/broadcastradio/1.0/vts/functional/Android.bp
index 7040a01..9ba9fbe 100644
--- a/broadcastradio/1.0/vts/functional/Android.bp
+++ b/broadcastradio/1.0/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.broadcastradio@1.0",
"android.hardware.broadcastradio@vts-utils-lib",
],
+ test_suites: ["general-tests"],
}
diff --git a/broadcastradio/1.1/vts/functional/Android.bp b/broadcastradio/1.1/vts/functional/Android.bp
index 9240cf0..0a02a69 100644
--- a/broadcastradio/1.1/vts/functional/Android.bp
+++ b/broadcastradio/1.1/vts/functional/Android.bp
@@ -25,4 +25,5 @@
"android.hardware.broadcastradio@vts-utils-lib",
"libgmock",
],
+ test_suites: ["general-tests"],
}
diff --git a/broadcastradio/2.0/vts/functional/Android.bp b/broadcastradio/2.0/vts/functional/Android.bp
index 6940bca..3e18a54 100644
--- a/broadcastradio/2.0/vts/functional/Android.bp
+++ b/broadcastradio/2.0/vts/functional/Android.bp
@@ -28,4 +28,5 @@
"android.hardware.broadcastradio@vts-utils-lib",
"libgmock",
],
+ test_suites: ["general-tests"],
}
diff --git a/broadcastradio/common/tests/Android.bp b/broadcastradio/common/tests/Android.bp
index 3ba31db..ef8733c 100644
--- a/broadcastradio/common/tests/Android.bp
+++ b/broadcastradio/common/tests/Android.bp
@@ -36,6 +36,7 @@
"android.hardware.broadcastradio@1.1",
"android.hardware.broadcastradio@2.0",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -59,6 +60,7 @@
shared_libs: [
"android.hardware.broadcastradio@2.0",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -73,4 +75,5 @@
"WorkerThread_test.cpp",
],
static_libs: ["android.hardware.broadcastradio@common-utils-lib"],
+ test_suites: ["general-tests"],
}
diff --git a/camera/metadata/3.4/types.hal b/camera/metadata/3.4/types.hal
index 4eb6929..61a399e 100644
--- a/camera/metadata/3.4/types.hal
+++ b/camera/metadata/3.4/types.hal
@@ -113,6 +113,15 @@
= 0x18,
};
+/** android.sensor.info.colorFilterArrangement enumeration values added since v3.2
+ * @see ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT
+ */
+enum CameraMetadataEnumAndroidSensorInfoColorFilterArrangement :
+ @3.2::CameraMetadataEnumAndroidSensorInfoColorFilterArrangement {
+ ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO,
+ ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR,
+};
+
/** android.info.supportedBufferManagementVersion enumeration values
* @see ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION
*/
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index eb8d43e..f8f058e 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -38,6 +38,7 @@
"android.hardware.camera.device@3.3",
"android.hardware.camera.device@3.4",
"android.hardware.camera.device@3.5",
+ "android.hardware.camera.metadata@3.4",
"android.hardware.camera.provider@2.4",
"android.hardware.graphics.allocator@2.0",
"android.hardware.graphics.common@1.0",
@@ -46,4 +47,5 @@
"libgrallocusage",
"libhidlmemory",
],
+ test_suites: ["general-tests"],
}
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index c324d59..bb03d91 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -31,8 +31,11 @@
#include <android/hardware/camera/device/3.5/ICameraDevice.h>
#include <android/hardware/camera/device/3.3/ICameraDeviceSession.h>
#include <android/hardware/camera/device/3.4/ICameraDeviceSession.h>
+#include <android/hardware/camera/device/3.5/ICameraDeviceSession.h>
#include <android/hardware/camera/device/3.4/ICameraDeviceCallback.h>
+#include <android/hardware/camera/device/3.5/ICameraDeviceCallback.h>
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
+#include <android/hardware/camera/metadata/3.4/types.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <binder/MemoryHeapBase.h>
#include <CameraMetadata.h>
@@ -110,6 +113,7 @@
using ::android::hardware::camera::device::V1_0::ICameraDevicePreviewCallback;
using ::android::hardware::camera::device::V1_0::FrameCallbackFlag;
using ::android::hardware::camera::device::V1_0::HandleTimestampMessage;
+using ::android::hardware::camera::metadata::V3_4::CameraMetadataEnumAndroidSensorInfoColorFilterArrangement;
using ::android::hardware::MessageQueue;
using ::android::hardware::kSynchronizedReadWrite;
using ::android::hidl::allocator::V1_0::IAllocator;
@@ -130,6 +134,7 @@
const int64_t kEmptyFlushTimeoutMSec = 200;
const char kDumpOutput[] = "/dev/null";
const uint32_t kBurstFrameCount = 10;
+const int64_t kBufferReturnTimeoutSec = 1;
struct AvailableStream {
int32_t width;
@@ -541,7 +546,7 @@
hidl_vec<hidl_string> getCameraDeviceNames(sp<ICameraProvider> provider);
- struct EmptyDeviceCb : public V3_4::ICameraDeviceCallback {
+ struct EmptyDeviceCb : public V3_5::ICameraDeviceCallback {
virtual Return<void> processCaptureResult(
const hidl_vec<CaptureResult>& /*results*/) override {
ALOGI("processCaptureResult callback");
@@ -561,21 +566,63 @@
ADD_FAILURE(); // Empty callback should not reach here
return Void();
}
+
+ virtual Return<void> requestStreamBuffers(
+ const hidl_vec<V3_5::BufferRequest>&,
+ requestStreamBuffers_cb _hidl_cb) override {
+ ALOGI("requestStreamBuffers callback");
+ // HAL might want to request buffer after configureStreams, but tests with EmptyDeviceCb
+ // doesn't actually need to send capture requests, so just return an error.
+ hidl_vec<V3_5::StreamBufferRet> emptyBufRets;
+ _hidl_cb(V3_5::BufferRequestStatus::FAILED_UNKNOWN, emptyBufRets);
+ return Void();
+ }
+
+ virtual Return<void> returnStreamBuffers(const hidl_vec<StreamBuffer>&) override {
+ ALOGI("returnStreamBuffers");
+ ADD_FAILURE(); // Empty callback should not reach here
+ return Void();
+ }
+
};
- struct DeviceCb : public V3_4::ICameraDeviceCallback {
+ struct DeviceCb : public V3_5::ICameraDeviceCallback {
DeviceCb(CameraHidlTest *parent, bool checkMonochromeResult) : mParent(parent),
mCheckMonochromeResult(checkMonochromeResult) {}
+
Return<void> processCaptureResult_3_4(
const hidl_vec<V3_4::CaptureResult>& results) override;
Return<void> processCaptureResult(const hidl_vec<CaptureResult>& results) override;
Return<void> notify(const hidl_vec<NotifyMsg>& msgs) override;
+ Return<void> requestStreamBuffers(
+ const hidl_vec<V3_5::BufferRequest>& bufReqs,
+ requestStreamBuffers_cb _hidl_cb) override;
+
+ Return<void> returnStreamBuffers(const hidl_vec<StreamBuffer>& buffers) override;
+
+ void setCurrentStreamConfig(const hidl_vec<V3_2::Stream>& streams,
+ const hidl_vec<V3_2::HalStream>& halStreams);
+
+ void waitForBuffersReturned();
+
private:
bool processCaptureResultLocked(const CaptureResult& results);
- CameraHidlTest *mParent; // Parent object
+ CameraHidlTest *mParent; // Parent object
bool mCheckMonochromeResult;
+ bool hasOutstandingBuffersLocked();
+
+ /* members for requestStreamBuffers() and returnStreamBuffers()*/
+ std::mutex mLock; // protecting members below
+ bool mUseHalBufManager = false;
+ hidl_vec<V3_2::Stream> mStreams;
+ hidl_vec<V3_2::HalStream> mHalStreams;
+ uint64_t mNextBufferId = 1;
+ using OutstandingBuffers = std::unordered_map<uint64_t, hidl_handle>;
+ // size == mStreams.size(). Tracking each streams outstanding buffers
+ std::vector<OutstandingBuffers> mOutstandingBufferIds;
+ std::condition_variable mFlushedCondition;
};
struct TorchProviderCb : public ICameraProviderCallback {
@@ -659,21 +706,27 @@
camera_metadata_t **staticMeta /*out*/);
void castSession(const sp<ICameraDeviceSession> &session, int32_t deviceVersion,
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
- sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/);
+ sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/);
void createStreamConfiguration(const ::android::hardware::hidl_vec<V3_2::Stream>& streams3_2,
StreamConfigurationMode configMode,
::android::hardware::camera::device::V3_2::StreamConfiguration *config3_2,
- ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4);
+ ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4,
+ ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5);
void configurePreviewStreams3_4(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
const AvailableStream *previewThreshold,
const std::unordered_set<std::string>& physicalIds,
sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/,
V3_2::Stream* previewStream /*out*/,
device::V3_4::HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/);
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *cb /*out*/,
+ uint32_t streamConfigCounter = 0);
void configurePreviewStream(const std::string &name, int32_t deviceVersion,
sp<ICameraProvider> provider,
const AvailableStream *previewThreshold,
@@ -681,7 +734,10 @@
V3_2::Stream *previewStream /*out*/,
HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/);
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *cb /*out*/,
+ uint32_t streamConfigCounter = 0);
void verifyLogicalCameraMetadata(const std::string& cameraName,
const ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice>& device,
@@ -693,6 +749,14 @@
void verifyMonochromeCameraResult(
const ::android::hardware::camera::common::V1_0::helper::CameraMetadata& metadata);
+ void verifyBuffersReturned(sp<device::V3_2::ICameraDeviceSession> session,
+ int deviceVerison, int32_t streamId, sp<DeviceCb> cb,
+ uint32_t streamConfigCounter = 0);
+
+ void verifyBuffersReturned(sp<device::V3_4::ICameraDeviceSession> session,
+ hidl_vec<int32_t> streamIds, sp<DeviceCb> cb,
+ uint32_t streamConfigCounter = 0);
+
static Status getAvailableOutputStreams(camera_metadata_t *staticMeta,
std::vector<AvailableStream> &outputStreams,
const AvailableStream *threshold = nullptr);
@@ -1092,9 +1156,51 @@
if (request->shutterTimestamp != 0) {
notify = true;
}
+
+ if (mUseHalBufManager) {
+ returnStreamBuffers(results.outputBuffers);
+ }
return notify;
}
+void CameraHidlTest::DeviceCb::setCurrentStreamConfig(
+ const hidl_vec<V3_2::Stream>& streams, const hidl_vec<V3_2::HalStream>& halStreams) {
+ ASSERT_EQ(streams.size(), halStreams.size());
+ ASSERT_NE(streams.size(), 0);
+ for (size_t i = 0; i < streams.size(); i++) {
+ ASSERT_EQ(streams[i].id, halStreams[i].id);
+ }
+ std::lock_guard<std::mutex> l(mLock);
+ mUseHalBufManager = true;
+ mStreams = streams;
+ mHalStreams = halStreams;
+ mOutstandingBufferIds.clear();
+ for (size_t i = 0; i < streams.size(); i++) {
+ mOutstandingBufferIds.emplace_back();
+ }
+}
+
+bool CameraHidlTest::DeviceCb::hasOutstandingBuffersLocked() {
+ if (!mUseHalBufManager) {
+ return false;
+ }
+ for (const auto& outstandingBuffers : mOutstandingBufferIds) {
+ if (!outstandingBuffers.empty()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void CameraHidlTest::DeviceCb::waitForBuffersReturned() {
+ std::unique_lock<std::mutex> lk(mLock);
+ if (hasOutstandingBuffersLocked()) {
+ auto timeout = std::chrono::seconds(kBufferReturnTimeoutSec);
+ auto st = mFlushedCondition.wait_for(lk, timeout);
+ ASSERT_NE(std::cv_status::timeout, st);
+ }
+}
+
Return<void> CameraHidlTest::DeviceCb::notify(
const hidl_vec<NotifyMsg>& messages) {
std::lock_guard<std::mutex> l(mParent->mLock);
@@ -1137,6 +1243,124 @@
return Void();
}
+Return<void> CameraHidlTest::DeviceCb::requestStreamBuffers(
+ const hidl_vec<V3_5::BufferRequest>& bufReqs,
+ requestStreamBuffers_cb _hidl_cb) {
+ using V3_5::BufferRequestStatus;
+ using V3_5::StreamBufferRet;
+ using V3_5::StreamBufferRequestError;
+ hidl_vec<StreamBufferRet> bufRets;
+ std::unique_lock<std::mutex> l(mLock);
+
+ if (!mUseHalBufManager) {
+ ALOGE("%s: Camera does not support HAL buffer management", __FUNCTION__);
+ ADD_FAILURE();
+ _hidl_cb(BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS, bufRets);
+ return Void();
+ }
+
+ if (bufReqs.size() > mStreams.size()) {
+ ALOGE("%s: illegal buffer request: too many requests!", __FUNCTION__);
+ ADD_FAILURE();
+ _hidl_cb(BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS, bufRets);
+ return Void();
+ }
+
+ std::vector<int32_t> indexes(bufReqs.size());
+ for (size_t i = 0; i < bufReqs.size(); i++) {
+ bool found = false;
+ for (size_t idx = 0; idx < mStreams.size(); idx++) {
+ if (bufReqs[i].streamId == mStreams[idx].id) {
+ found = true;
+ indexes[i] = idx;
+ break;
+ }
+ }
+ if (!found) {
+ ALOGE("%s: illegal buffer request: unknown streamId %d!",
+ __FUNCTION__, bufReqs[i].streamId);
+ ADD_FAILURE();
+ _hidl_cb(BufferRequestStatus::FAILED_ILLEGAL_ARGUMENTS, bufRets);
+ return Void();
+ }
+ }
+
+ bool allStreamOk = true;
+ bool atLeastOneStreamOk = false;
+ bufRets.resize(bufReqs.size());
+ for (size_t i = 0; i < bufReqs.size(); i++) {
+ int32_t idx = indexes[i];
+ const auto& stream = mStreams[idx];
+ const auto& halStream = mHalStreams[idx];
+ const V3_5::BufferRequest& bufReq = bufReqs[i];
+ if (mOutstandingBufferIds[idx].size() + bufReq.numBuffersRequested > halStream.maxBuffers) {
+ bufRets[i].streamId = stream.id;
+ bufRets[i].val.error(StreamBufferRequestError::MAX_BUFFER_EXCEEDED);
+ allStreamOk = false;
+ continue;
+ }
+
+ hidl_vec<StreamBuffer> tmpRetBuffers(bufReq.numBuffersRequested);
+ for (size_t i = 0; i < bufReq.numBuffersRequested; i++) {
+ hidl_handle buffer_handle;
+ mParent->allocateGraphicBuffer(stream.width, stream.height,
+ android_convertGralloc1To0Usage(
+ halStream.producerUsage, halStream.consumerUsage),
+ halStream.overrideFormat, &buffer_handle);
+
+ tmpRetBuffers[i] = {stream.id, mNextBufferId, buffer_handle, BufferStatus::OK,
+ nullptr, nullptr};
+ mOutstandingBufferIds[idx].insert(std::make_pair(mNextBufferId++, buffer_handle));
+ }
+ atLeastOneStreamOk = true;
+ bufRets[0].val.buffers(std::move(tmpRetBuffers));
+ }
+
+ if (allStreamOk) {
+ _hidl_cb(BufferRequestStatus::OK, bufRets);
+ } else if (atLeastOneStreamOk) {
+ _hidl_cb(BufferRequestStatus::FAILED_PARTIAL, bufRets);
+ } else {
+ _hidl_cb(BufferRequestStatus::FAILED_UNKNOWN, bufRets);
+ }
+
+ if (!hasOutstandingBuffersLocked()) {
+ l.unlock();
+ mFlushedCondition.notify_one();
+ }
+ return Void();
+}
+
+Return<void> CameraHidlTest::DeviceCb::returnStreamBuffers(
+ const hidl_vec<StreamBuffer>& buffers) {
+ if (!mUseHalBufManager) {
+ ALOGE("%s: Camera does not support HAL buffer management", __FUNCTION__);
+ ADD_FAILURE();
+ }
+
+ std::lock_guard<std::mutex> l(mLock);
+ for (const auto& buf : buffers) {
+ bool found = false;
+ for (size_t idx = 0; idx < mOutstandingBufferIds.size(); idx++) {
+ if (mStreams[idx].id == buf.streamId &&
+ mOutstandingBufferIds[idx].count(buf.bufferId) == 1) {
+ mOutstandingBufferIds[idx].erase(buf.bufferId);
+ // TODO: check do we need to close/delete native handle or assume we have enough
+ // memory to run till the test finish? since we do not capture much requests (and
+ // most of time one buffer is sufficient)
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ continue;
+ }
+ ALOGE("%s: unknown buffer ID %" PRIu64, __FUNCTION__, buf.bufferId);
+ ADD_FAILURE();
+ }
+ return Void();
+}
+
hidl_vec<hidl_string> CameraHidlTest::getCameraDeviceNames(sp<ICameraProvider> provider) {
std::vector<std::string> cameraDeviceNames;
Return<void> ret;
@@ -2377,14 +2601,18 @@
// cast the 3.3/3.4 interface, and that lower versions can't be cast to it.
sp<device::V3_3::ICameraDeviceSession> sessionV3_3;
sp<device::V3_4::ICameraDeviceSession> sessionV3_4;
- castSession(session, deviceVersion, &sessionV3_3, &sessionV3_4);
- if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4 ||
- deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
+ sp<device::V3_5::ICameraDeviceSession> sessionV3_5;
+ castSession(session, deviceVersion, &sessionV3_3, &sessionV3_4, &sessionV3_5);
+ if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_5) {
+ ASSERT_TRUE(sessionV3_5.get() != nullptr);
+ } else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4) {
ASSERT_TRUE(sessionV3_4.get() != nullptr);
} else if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_3) {
ASSERT_TRUE(sessionV3_3.get() != nullptr);
- } else {
+ } else { //V3_2
ASSERT_TRUE(sessionV3_3.get() == nullptr);
+ ASSERT_TRUE(sessionV3_4.get() == nullptr);
+ ASSERT_TRUE(sessionV3_5.get() == nullptr);
}
native_handle_t* raw_handle = native_handle_create(1, 0);
raw_handle->data[0] = open(kDumpOutput, O_RDWR);
@@ -2540,15 +2768,17 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider,
&session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
ASSERT_NE(0u, outputStreams.size());
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
for (auto& it : outputStreams) {
V3_2::Stream stream3_2;
bool isJpeg = static_cast<PixelFormat>(it.format) == PixelFormat::BLOB;
@@ -2561,11 +2791,20 @@
(isJpeg) ? static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF) : 0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams3_2 = {stream3_2};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams3_2, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ ASSERT_EQ(halConfig.streams[0].v3_3.v3_2.id, streamId);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -2617,8 +2856,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputStreams.clear();
ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
@@ -2633,29 +2873,38 @@
GRALLOC1_CONSUMER_USAGE_HWCOMPOSER,
0,
StreamRotation::ROTATION_0};
+ uint32_t streamConfigCounter = 0;
::android::hardware::hidl_vec<V3_2::Stream> streams = {stream3_2};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
- ret = session3_4->configureStreams_3_4(config3_4,
- [](Status s, device::V3_4::HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
(Status::INTERNAL_ERROR == s));
- });
+ });
+ } else if (session3_4 != nullptr) {
+ ret = session3_4->configureStreams_3_4(config3_4,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
} else if(session3_3 != nullptr) {
ret = session3_3->configureStreams_3_3(config3_2,
- [](Status s, device::V3_3::HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
- (Status::INTERNAL_ERROR == s));
- });
+ [](Status s, device::V3_3::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
} else {
ret = session->configureStreams(config3_2,
- [](Status s, HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
- (Status::INTERNAL_ERROR == s));
- });
+ [](Status s, HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
}
ASSERT_TRUE(ret.isOk());
@@ -2669,8 +2918,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5, [](Status s,
+ device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if(session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4, [](Status s,
device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -2699,8 +2954,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if(session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -2728,8 +2989,14 @@
static_cast<StreamRotation>(UINT32_MAX)};
streams[0] = stream3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if(session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if(session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -2776,8 +3043,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
Status rc = isZSLModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -2807,6 +3075,7 @@
int32_t streamId = 0;
bool hasPrivToY8 = false, hasY8ToY8 = false, hasY8ToBlob = false;
+ uint32_t streamConfigCounter = 0;
for (auto& inputIter : inputOutputMap) {
AvailableStream input;
ASSERT_EQ(Status::OK, findLargestSize(inputStreams, inputIter.inputFormat,
@@ -2857,11 +3126,19 @@
::android::hardware::hidl_vec<V3_2::Stream> streams = {inputStream, zslStream,
outputStream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(3u, halConfig.streams.size());
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -2923,9 +3200,14 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMetaBuffer /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
- ASSERT_NE(session3_4, nullptr);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ if (deviceVersion == CAMERA_DEVICE_API_VERSION_3_4) {
+ ASSERT_NE(session3_4, nullptr);
+ } else {
+ ASSERT_NE(session3_5, nullptr);
+ }
std::unordered_set<int32_t> availableSessionKeys;
auto rc = getSupportedKeys(staticMetaBuffer, ANDROID_REQUEST_AVAILABLE_SESSION_KEYS,
@@ -2964,17 +3246,29 @@
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_4::Stream> streams = {previewStream};
::android::hardware::camera::device::V3_4::StreamConfiguration config;
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
config.streams = streams;
config.operationMode = StreamConfigurationMode::NORMAL_MODE;
const camera_metadata_t *sessionParamsBuffer = sessionParams.getAndLock();
config.sessionParams.setToExternal(
reinterpret_cast<uint8_t *> (const_cast<camera_metadata_t *> (sessionParamsBuffer)),
get_camera_metadata_size(sessionParamsBuffer));
- ret = session3_4->configureStreams_3_4(config,
- [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(1u, halConfig.streams.size());
- });
+ config3_5.v3_4 = config;
+ config3_5.streamConfigCounter = 0;
+ if (session3_5 != nullptr) {
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ });
+ } else {
+ ret = session3_4->configureStreams_3_4(config,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ });
+ }
+
ASSERT_TRUE(ret.isOk());
free_camera_metadata(staticMetaBuffer);
@@ -3009,8 +3303,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputBlobStreams.clear();
ASSERT_EQ(Status::OK,
@@ -3024,6 +3319,7 @@
ASSERT_NE(0u, outputPreviewStreams.size());
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
for (auto& blobIter : outputBlobStreams) {
for (auto& previewIter : outputPreviewStreams) {
V3_2::Stream previewStream = {streamId++,
@@ -3044,11 +3340,19 @@
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams = {previewStream,
blobStream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(2u, halConfig.streams.size());
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -3098,8 +3402,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
Status rc = isConstrainedModeAvailable(staticMeta);
if (Status::METHOD_NOT_SUPPORTED == rc) {
@@ -3114,6 +3419,7 @@
ASSERT_EQ(Status::OK, rc);
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
V3_2::Stream stream = {streamId,
StreamType::OUTPUT,
static_cast<uint32_t>(hfrStream.width),
@@ -3123,11 +3429,20 @@
0,
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams = {stream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ ASSERT_EQ(halConfig.streams[0].v3_3.v3_2.id, streamId);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[streamId](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -3161,8 +3476,15 @@
StreamRotation::ROTATION_0};
streams[0] = stream;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
@@ -3193,8 +3515,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -3222,8 +3550,14 @@
StreamRotation::ROTATION_0};
streams[0] = stream;
createStreamConfiguration(streams, StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration) {
ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
@@ -3273,8 +3607,9 @@
sp<ICameraDeviceSession> session;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/);
- castSession(session, deviceVersion, &session3_3, &session3_4);
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
outputBlobStreams.clear();
ASSERT_EQ(Status::OK,
@@ -3289,6 +3624,7 @@
ASSERT_NE(0u, outputVideoStreams.size());
int32_t streamId = 0;
+ uint32_t streamConfigCounter = 0;
for (auto& blobIter : outputBlobStreams) {
for (auto& videoIter : outputVideoStreams) {
V3_2::Stream videoStream = {streamId++,
@@ -3308,11 +3644,19 @@
static_cast<V3_2::DataspaceFlags>(Dataspace::V0_JFIF),
StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<V3_2::Stream> streams = {videoStream, blobStream};
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ config3_5.streamConfigCounter = streamConfigCounter++;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [](Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(2u, halConfig.streams.size());
+ });
+ } else if (session3_4 != nullptr) {
ret = session3_4->configureStreams_3_4(config3_4,
[](Status s, device::V3_4::HalStreamConfiguration halConfig) {
ASSERT_EQ(Status::OK, s);
@@ -3363,12 +3707,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet =
@@ -3399,17 +3745,26 @@
ASSERT_TRUE(ret.isOk());
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
-
- StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
- bufferId,
- buffer_handle,
- BufferStatus::OK,
- nullptr,
- nullptr};
+ StreamBuffer outputBuffer;
+ if (useHalBufManager) {
+ outputBuffer = {halStreamConfig.streams[0].id,
+ /*bufferId*/ 0,
+ buffer_handle,
+ BufferStatus::OK,
+ nullptr,
+ nullptr};
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ outputBuffer = {halStreamConfig.streams[0].id,
+ bufferId,
+ buffer_handle,
+ BufferStatus::OK,
+ nullptr,
+ nullptr};
+ }
::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {outputBuffer};
StreamBuffer emptyInputBuffer = {-1, 0, nullptr, BufferStatus::ERROR, nullptr,
nullptr};
@@ -3489,6 +3844,10 @@
ASSERT_EQ(previewStream.id, inflightReq.resultOutputBuffers[0].streamId);
}
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, previewStream.id, cb);
+ }
+
ret = session->close();
ASSERT_TRUE(ret.isOk());
}
@@ -3570,12 +3929,16 @@
V3_4::HalStreamConfiguration halStreamConfig;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
V3_2::Stream previewStream;
sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
+ sp<DeviceCb> cb;
configurePreviewStreams3_4(name, deviceVersion, mProvider, &previewThreshold, physicalIds,
- &session3_4, &previewStream, &halStreamConfig /*out*/,
- &supportsPartialResults /*out*/, &partialResultCount /*out*/);
+ &session3_4, &session3_5, &previewStream, &halStreamConfig /*out*/,
+ &supportsPartialResults /*out*/, &partialResultCount /*out*/,
+ &useHalBufManager /*out*/, &cb /*out*/);
ASSERT_NE(session3_4, nullptr);
std::shared_ptr<ResultMetadataQueue> resultQueue;
@@ -3604,14 +3967,19 @@
size_t k = 0;
for (const auto& halStream : halStreamConfig.streams) {
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStream.v3_3.v3_2.producerUsage,
- halStream.v3_3.v3_2.consumerUsage),
- halStream.v3_3.v3_2.overrideFormat, &buffer_handle);
- graphicBuffers.push_back(buffer_handle);
- outputBuffers[k] = {halStream.v3_3.v3_2.id, bufferId, buffer_handle,
- BufferStatus::OK, nullptr, nullptr};
- bufferId++;
+ if (useHalBufManager) {
+ outputBuffers[k] = {halStream.v3_3.v3_2.id, /*bufferId*/0, buffer_handle,
+ BufferStatus::OK, nullptr, nullptr};
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStream.v3_3.v3_2.producerUsage,
+ halStream.v3_3.v3_2.consumerUsage),
+ halStream.v3_3.v3_2.overrideFormat, &buffer_handle);
+ graphicBuffers.push_back(buffer_handle);
+ outputBuffers[k] = {halStream.v3_3.v3_2.id, bufferId, buffer_handle,
+ BufferStatus::OK, nullptr, nullptr};
+ bufferId++;
+ }
k++;
}
hidl_vec<V3_4::PhysicalCameraSetting> camSettings(1);
@@ -3713,6 +4081,15 @@
defaultPreviewSettings.unlock(settingsBuffer);
filteredSettings.unlock(filteredSettingsBuffer);
+
+ if (useHalBufManager) {
+ hidl_vec<int32_t> streamIds(halStreamConfig.streams.size());
+ for (size_t i = 0; i < streamIds.size(); i++) {
+ streamIds[i] = halStreamConfig.streams[i].v3_3.v3_2.id;
+ }
+ verifyBuffersReturned(session3_4, streamIds, cb);
+ }
+
ret = session3_4->close();
ASSERT_TRUE(ret.isOk());
}
@@ -3761,12 +4138,15 @@
ASSERT_TRUE(ret.isOk());
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
+ sp<DeviceCb> cb;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold,
&session /*out*/, &previewStream /*out*/, &halStreamConfig /*out*/,
- &supportsPartialResults /*out*/, &partialResultCount /*out*/);
+ &supportsPartialResults /*out*/, &partialResultCount /*out*/,
+ &useHalBufManager /*out*/, &cb /*out*/);
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet = session->getCaptureResultMetadataQueue(
@@ -3800,13 +4180,18 @@
std::unique_lock<std::mutex> l(mLock);
isoValues[i] = ((i % 2) == 0) ? isoRange.data.i32[0] : isoRange.data.i32[1];
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffers[i]);
+ if (useHalBufManager) {
+ outputBuffers[i] = {halStreamConfig.streams[0].id, /*bufferId*/0,
+ nullptr, BufferStatus::OK, nullptr, nullptr};
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffers[i]);
+ outputBuffers[i] = {halStreamConfig.streams[0].id, bufferId + i,
+ buffers[i], BufferStatus::OK, nullptr, nullptr};
+ }
- outputBuffers[i] = {halStreamConfig.streams[0].id, bufferId + i,
- buffers[i], BufferStatus::OK, nullptr, nullptr};
requestMeta.append(reinterpret_cast<camera_metadata_t *> (settings.data()));
// Disable all 3A routines
@@ -3859,6 +4244,9 @@
std::round(isoValues[i]*isoTol));
}
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, previewStream.id, cb);
+ }
ret = session->close();
ASSERT_TRUE(ret.isOk());
}
@@ -3888,18 +4276,25 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+
+ if (useHalBufManager) {
+ bufferId = 0;
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ }
StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
bufferId,
@@ -3955,12 +4350,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
Return<void> ret;
@@ -4019,12 +4416,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
std::shared_ptr<ResultMetadataQueue> resultQueue;
auto resultQueueRet =
@@ -4054,10 +4453,14 @@
ASSERT_TRUE(ret.isOk());
hidl_handle buffer_handle;
- allocateGraphicBuffer(previewStream.width, previewStream.height,
- android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage),
- halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ if (useHalBufManager) {
+ bufferId = 0;
+ } else {
+ allocateGraphicBuffer(previewStream.width, previewStream.height,
+ android_convertGralloc1To0Usage(halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage),
+ halStreamConfig.streams[0].overrideFormat, &buffer_handle);
+ }
StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
bufferId,
@@ -4124,6 +4527,10 @@
}
}
+ if (useHalBufManager) {
+ verifyBuffersReturned(session, deviceVersion, previewStream.id, cb);
+ }
+
ret = session->close();
ASSERT_TRUE(ret.isOk());
}
@@ -4149,12 +4556,14 @@
V3_2::Stream previewStream;
HalStreamConfiguration halStreamConfig;
sp<ICameraDeviceSession> session;
+ sp<DeviceCb> cb;
bool supportsPartialResults = false;
+ bool useHalBufManager = false;
uint32_t partialResultCount = 0;
configurePreviewStream(name, deviceVersion, mProvider, &previewThreshold, &session /*out*/,
&previewStream /*out*/, &halStreamConfig /*out*/,
&supportsPartialResults /*out*/,
- &partialResultCount /*out*/);
+ &partialResultCount /*out*/, &useHalBufManager /*out*/, &cb /*out*/);
Return<Status> returnStatus = session->flush();
ASSERT_TRUE(returnStatus.isOk());
@@ -4496,9 +4905,11 @@
const ::android::hardware::hidl_vec<V3_2::Stream>& streams3_2,
StreamConfigurationMode configMode,
::android::hardware::camera::device::V3_2::StreamConfiguration *config3_2 /*out*/,
- ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4 /*out*/) {
+ ::android::hardware::camera::device::V3_4::StreamConfiguration *config3_4 /*out*/,
+ ::android::hardware::camera::device::V3_5::StreamConfiguration *config3_5 /*out*/) {
ASSERT_NE(nullptr, config3_2);
ASSERT_NE(nullptr, config3_4);
+ ASSERT_NE(nullptr, config3_5);
::android::hardware::hidl_vec<V3_4::Stream> streams3_4(streams3_2.size());
size_t idx = 0;
@@ -4507,7 +4918,9 @@
stream.v3_2 = stream3_2;
streams3_4[idx++] = stream;
}
- *config3_4 = {streams3_4, configMode, {}};
+ // Caller is responsible to fill in non-zero config3_5->streamConfigCounter after this returns
+ *config3_5 = {{streams3_4, configMode, {}}, 0};
+ *config3_4 = config3_5->v3_4;
*config3_2 = {streams3_2, configMode};
}
@@ -4517,15 +4930,22 @@
const AvailableStream *previewThreshold,
const std::unordered_set<std::string>& physicalIds,
sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/,
V3_2::Stream *previewStream /*out*/,
device::V3_4::HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/) {
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *outCb /*out*/,
+ uint32_t streamConfigCounter) {
ASSERT_NE(nullptr, session3_4);
+ ASSERT_NE(nullptr, session3_5);
ASSERT_NE(nullptr, halStreamConfig);
ASSERT_NE(nullptr, previewStream);
ASSERT_NE(nullptr, supportsPartialResults);
ASSERT_NE(nullptr, partialResultCount);
+ ASSERT_NE(nullptr, useHalBufManager);
+ ASSERT_NE(nullptr, outCb);
ASSERT_FALSE(physicalIds.empty());
std::vector<AvailableStream> outputPreviewStreams;
@@ -4574,10 +4994,19 @@
session = newSession;
});
ASSERT_TRUE(ret.isOk());
+ *outCb = cb;
sp<device::V3_3::ICameraDeviceSession> session3_3;
- castSession(session, deviceVersion, &session3_3, session3_4);
- ASSERT_NE(nullptr, session3_4);
+ castSession(session, deviceVersion, &session3_3, session3_4, session3_5);
+ ASSERT_NE(nullptr, (*session3_4).get());
+
+ *useHalBufManager = false;
+ status = find_camera_metadata_ro_entry(staticMeta,
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry);
+ if ((0 == status) && (entry.count == 1)) {
+ *useHalBufManager = (entry.data.u8[0] ==
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5);
+ }
outputPreviewStreams.clear();
auto rc = getAvailableOutputStreams(staticMeta,
@@ -4599,6 +5028,7 @@
}
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
config3_4 = {streams3_4, StreamConfigurationMode::NORMAL_MODE, {}};
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
ret = (*session3_4)->constructDefaultRequestSettings(reqTemplate,
@@ -4608,12 +5038,32 @@
});
ASSERT_TRUE(ret.isOk());
- ret = (*session3_4)->configureStreams_3_4(config3_4,
- [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(physicalIds.size(), halConfig.streams.size());
- *halStreamConfig = halConfig;
- });
+ if (*session3_5 != nullptr) {
+ config3_5.v3_4 = config3_4;
+ config3_5.streamConfigCounter = streamConfigCounter;
+ ret = (*session3_5)->configureStreams_3_5(config3_5,
+ [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(physicalIds.size(), halConfig.streams.size());
+ *halStreamConfig = halConfig;
+ if (*useHalBufManager) {
+ hidl_vec<V3_2::Stream> streams(physicalIds.size());
+ hidl_vec<V3_2::HalStream> halStreams(physicalIds.size());
+ for (size_t i = 0; i < physicalIds.size(); i++) {
+ streams[i] = streams3_4[i].v3_2;
+ halStreams[i] = halConfig.streams[i].v3_3.v3_2;
+ }
+ cb->setCurrentStreamConfig(streams, halStreams);
+ }
+ });
+ } else {
+ ret = (*session3_4)->configureStreams_3_4(config3_4,
+ [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(physicalIds.size(), halConfig.streams.size());
+ *halStreamConfig = halConfig;
+ });
+ }
*previewStream = streams3_4[0].v3_2;
ASSERT_TRUE(ret.isOk());
}
@@ -4626,12 +5076,17 @@
V3_2::Stream *previewStream /*out*/,
HalStreamConfiguration *halStreamConfig /*out*/,
bool *supportsPartialResults /*out*/,
- uint32_t *partialResultCount /*out*/) {
+ uint32_t *partialResultCount /*out*/,
+ bool *useHalBufManager /*out*/,
+ sp<DeviceCb> *outCb /*out*/,
+ uint32_t streamConfigCounter) {
ASSERT_NE(nullptr, session);
ASSERT_NE(nullptr, previewStream);
ASSERT_NE(nullptr, halStreamConfig);
ASSERT_NE(nullptr, supportsPartialResults);
ASSERT_NE(nullptr, partialResultCount);
+ ASSERT_NE(nullptr, useHalBufManager);
+ ASSERT_NE(nullptr, outCb);
std::vector<AvailableStream> outputPreviewStreams;
::android::sp<ICameraDevice> device3_x;
@@ -4678,10 +5133,20 @@
*session = newSession;
});
ASSERT_TRUE(ret.isOk());
+ *outCb = cb;
sp<device::V3_3::ICameraDeviceSession> session3_3;
sp<device::V3_4::ICameraDeviceSession> session3_4;
- castSession(*session, deviceVersion, &session3_3, &session3_4);
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
+ castSession(*session, deviceVersion, &session3_3, &session3_4, &session3_5);
+
+ *useHalBufManager = false;
+ status = find_camera_metadata_ro_entry(staticMeta,
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, &entry);
+ if ((0 == status) && (entry.count == 1)) {
+ *useHalBufManager = (entry.data.u8[0] ==
+ ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_HIDL_DEVICE_3_5);
+ }
outputPreviewStreams.clear();
auto rc = getAvailableOutputStreams(staticMeta,
@@ -4698,9 +5163,33 @@
::android::hardware::hidl_vec<V3_2::Stream> streams3_2 = {stream3_2};
::android::hardware::camera::device::V3_2::StreamConfiguration config3_2;
::android::hardware::camera::device::V3_4::StreamConfiguration config3_4;
+ ::android::hardware::camera::device::V3_5::StreamConfiguration config3_5;
createStreamConfiguration(streams3_2, StreamConfigurationMode::NORMAL_MODE,
- &config3_2, &config3_4);
- if (session3_4 != nullptr) {
+ &config3_2, &config3_4, &config3_5);
+ if (session3_5 != nullptr) {
+ RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
+ ret = session3_5->constructDefaultRequestSettings(reqTemplate,
+ [&config3_5](auto status, const auto& req) {
+ ASSERT_EQ(Status::OK, status);
+ config3_5.v3_4.sessionParams = req;
+ });
+ ASSERT_TRUE(ret.isOk());
+ config3_5.streamConfigCounter = streamConfigCounter;
+ ret = session3_5->configureStreams_3_5(config3_5,
+ [&] (Status s, device::V3_4::HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ halStreamConfig->streams.resize(1);
+ halStreamConfig->streams[0] = halConfig.streams[0].v3_3.v3_2;
+ if (*useHalBufManager) {
+ hidl_vec<V3_2::Stream> streams(1);
+ hidl_vec<V3_2::HalStream> halStreams(1);
+ streams[0] = stream3_2;
+ halStreams[0] = halConfig.streams[0].v3_3.v3_2;
+ cb->setCurrentStreamConfig(streams, halStreams);
+ }
+ });
+ } else if (session3_4 != nullptr) {
RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
ret = session3_4->constructDefaultRequestSettings(reqTemplate,
[&config3_4](auto status, const auto& req) {
@@ -4742,18 +5231,25 @@
//Cast camera device session to corresponding version
void CameraHidlTest::castSession(const sp<ICameraDeviceSession> &session, int32_t deviceVersion,
sp<device::V3_3::ICameraDeviceSession> *session3_3 /*out*/,
- sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/) {
+ sp<device::V3_4::ICameraDeviceSession> *session3_4 /*out*/,
+ sp<device::V3_5::ICameraDeviceSession> *session3_5 /*out*/) {
ASSERT_NE(nullptr, session3_3);
ASSERT_NE(nullptr, session3_4);
+ ASSERT_NE(nullptr, session3_5);
switch (deviceVersion) {
- case CAMERA_DEVICE_API_VERSION_3_5:
+ case CAMERA_DEVICE_API_VERSION_3_5: {
+ auto castResult = device::V3_5::ICameraDeviceSession::castFrom(session);
+ ASSERT_TRUE(castResult.isOk());
+ *session3_5 = castResult;
+ }
+ [[fallthrough]];
case CAMERA_DEVICE_API_VERSION_3_4: {
auto castResult = device::V3_4::ICameraDeviceSession::castFrom(session);
ASSERT_TRUE(castResult.isOk());
*session3_4 = castResult;
- break;
}
+ [[fallthrough]];
case CAMERA_DEVICE_API_VERSION_3_3: {
auto castResult = device::V3_3::ICameraDeviceSession::castFrom(session);
ASSERT_TRUE(castResult.isOk());
@@ -4891,8 +5387,10 @@
retcode = find_camera_metadata_ro_entry(metadata,
ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, &entry);
if ((0 == retcode) && (entry.count == 1)) {
- ASSERT_TRUE(entry.data.i32[0] == ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO
- || entry.data.i32[0] == ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR);
+ ASSERT_TRUE(entry.data.i32[0] == static_cast<int32_t>(
+ CameraMetadataEnumAndroidSensorInfoColorFilterArrangement::ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO)
+ || entry.data.i32[0] == static_cast<int32_t>(
+ CameraMetadataEnumAndroidSensorInfoColorFilterArrangement::ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR));
}
// Check availableRequestKeys
@@ -5004,6 +5502,33 @@
}
}
+void CameraHidlTest::verifyBuffersReturned(
+ sp<device::V3_2::ICameraDeviceSession> session,
+ int deviceVersion, int32_t streamId,
+ sp<DeviceCb> cb, uint32_t streamConfigCounter) {
+ sp<device::V3_3::ICameraDeviceSession> session3_3;
+ sp<device::V3_4::ICameraDeviceSession> session3_4;
+ sp<device::V3_5::ICameraDeviceSession> session3_5;
+ castSession(session, deviceVersion, &session3_3, &session3_4, &session3_5);
+ ASSERT_NE(nullptr, session3_5.get());
+
+ hidl_vec<int32_t> streamIds(1);
+ streamIds[0] = streamId;
+ session3_5->signalStreamFlush(streamIds, /*streamConfigCounter*/streamConfigCounter);
+ cb->waitForBuffersReturned();
+}
+
+void CameraHidlTest::verifyBuffersReturned(
+ sp<device::V3_4::ICameraDeviceSession> session3_4,
+ hidl_vec<int32_t> streamIds, sp<DeviceCb> cb, uint32_t streamConfigCounter) {
+ auto castResult = device::V3_5::ICameraDeviceSession::castFrom(session3_4);
+ ASSERT_TRUE(castResult.isOk());
+ sp<device::V3_5::ICameraDeviceSession> session3_5 = castResult;
+ ASSERT_NE(nullptr, session3_5.get());
+
+ session3_5->signalStreamFlush(streamIds, /*streamConfigCounter*/streamConfigCounter);
+ cb->waitForBuffersReturned();
+}
// Open a device session with empty callbacks and return static metadata.
void CameraHidlTest::openEmptyDeviceSession(const std::string &name,
diff --git a/cas/1.0/default/Android.bp b/cas/1.0/default/Android.bp
index a80c47f..debb3e5 100644
--- a/cas/1.0/default/Android.bp
+++ b/cas/1.0/default/Android.bp
@@ -1,6 +1,5 @@
-cc_binary {
- name: "android.hardware.cas@1.0-service",
- vintf_fragments: ["android.hardware.cas@1.0-service.xml"],
+cc_defaults {
+ name: "cas_service_defaults",
defaults: ["hidl_defaults"],
vendor: true,
relative_install_path: "hw",
@@ -14,7 +13,6 @@
],
compile_multilib: "32",
- init_rc: ["android.hardware.cas@1.0-service.rc"],
shared_libs: [
"android.hardware.cas@1.0",
@@ -32,3 +30,19 @@
"media_plugin_headers",
],
}
+
+cc_binary {
+ name: "android.hardware.cas@1.0-service",
+ vintf_fragments: ["android.hardware.cas@1.0-service.xml"],
+ defaults: ["cas_service_defaults"],
+ init_rc: ["android.hardware.cas@1.0-service.rc"],
+}
+
+cc_binary {
+ name: "android.hardware.cas@1.0-service-lazy",
+ vintf_fragments: ["android.hardware.cas@1.0-service-lazy.xml"],
+ overrides: ["android.hardware.cas@1.0-service"],
+ defaults: ["cas_service_defaults"],
+ init_rc: ["android.hardware.cas@1.0-service-lazy.rc"],
+ cflags: ["-DLAZY_SERVICE"],
+}
diff --git a/cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc
new file mode 100644
index 0000000..735cfbc
--- /dev/null
+++ b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.rc
@@ -0,0 +1,9 @@
+service vendor.cas-hal-1-0 /vendor/bin/hw/android.hardware.cas@1.0-service
+ interface android.hardware.cas@1.0::IMediaCasService default
+ oneshot
+ disabled
+ class hal
+ user media
+ group mediadrm drmrpc
+ ioprio rt 4
+ writepid /dev/cpuset/foreground/tasks
diff --git a/cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml
new file mode 100644
index 0000000..9b55370
--- /dev/null
+++ b/cas/1.0/default/android.hardware.cas@1.0-service-lazy.xml
@@ -0,0 +1,11 @@
+<manifest version="1.0" type="device">
+ <hal format="hidl">
+ <name>android.hardware.cas</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IMediaCasService</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/cas/1.0/default/service.cpp b/cas/1.0/default/service.cpp
index 04a8ad9..2e6e55d 100644
--- a/cas/1.0/default/service.cpp
+++ b/cas/1.0/default/service.cpp
@@ -15,7 +15,11 @@
*/
//#define LOG_NDEBUG 0
+#ifdef LAZY_SERVICE
+#define LOG_TAG "android.hardware.cas@1.0-service-lazy"
+#else
#define LOG_TAG "android.hardware.cas@1.0-service"
+#endif
#include <binder/ProcessState.h>
#include <hidl/HidlTransportSupport.h>
@@ -25,24 +29,30 @@
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
-using android::hardware::cas::V1_0::implementation::MediaCasService;
+using android::hardware::LazyServiceRegistrar;
using android::hardware::cas::V1_0::IMediaCasService;
+using android::hardware::cas::V1_0::implementation::MediaCasService;
+
+#ifdef LAZY_SERVICE
+const bool kLazyService = true;
+#else
+const bool kLazyService = false;
+#endif
int main() {
- ALOGD("android.hardware.cas@1.0-service starting...");
-
- // The CAS HAL may communicate to other vendor components via
- // /dev/vndbinder
- android::ProcessState::initWithDriver("/dev/vndbinder");
-
configureRpcThreadpool(8, true /* callerWillJoin */);
// Setup hwbinder service
android::sp<IMediaCasService> service = new MediaCasService();
- android::status_t status = service->registerAsService();
- LOG_ALWAYS_FATAL_IF(
- status != android::OK,
- "Error while registering cas service: %d", status);
+ android::status_t status;
+ if (kLazyService) {
+ auto serviceRegistrar = std::make_shared<LazyServiceRegistrar>();
+ status = serviceRegistrar->registerServiceWithCallback(service);
+ } else {
+ status = service->registerAsService();
+ }
+ LOG_ALWAYS_FATAL_IF(status != android::OK, "Error while registering cas service: %d", status);
+
joinRpcThreadpool();
return 0;
}
diff --git a/cas/1.0/vts/functional/Android.bp b/cas/1.0/vts/functional/Android.bp
index 0db9bb0..622baa5 100644
--- a/cas/1.0/vts/functional/Android.bp
+++ b/cas/1.0/vts/functional/Android.bp
@@ -29,5 +29,6 @@
shared_libs: [
"libbinder",
],
+ test_suites: ["general-tests"],
}
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
index 49674e3..b88d88f 100644
--- a/compatibility_matrices/Android.bp
+++ b/compatibility_matrices/Android.bp
@@ -73,5 +73,6 @@
"kernel_config_current_4.4",
"kernel_config_current_4.9",
"kernel_config_current_4.14",
+ "kernel_config_current_4.19",
]
}
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index fd996fb..ceb53be 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -186,6 +186,7 @@
<hal format="hidl" optional="true">
<name>android.hardware.gnss</name>
<version>1.0-1</version>
+ <version>2.0</version>
<interface>
<name>IGnss</name>
<instance>default</instance>
diff --git a/configstore/1.0/vts/functional/Android.bp b/configstore/1.0/vts/functional/Android.bp
index 1b8a591..008b59d 100644
--- a/configstore/1.0/vts/functional/Android.bp
+++ b/configstore/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalConfigstoreV1_0TargetTest.cpp"],
static_libs: ["android.hardware.configstore@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/confirmationui/1.0/vts/functional/Android.bp b/confirmationui/1.0/vts/functional/Android.bp
index 823e035..d19d702 100644
--- a/confirmationui/1.0/vts/functional/Android.bp
+++ b/confirmationui/1.0/vts/functional/Android.bp
@@ -27,4 +27,5 @@
"libcn-cbor",
"android.hardware.confirmationui-support-lib",
],
+ test_suites: ["general-tests"],
}
diff --git a/confirmationui/support/Android.bp b/confirmationui/support/Android.bp
index 62156b3..e215baa 100644
--- a/confirmationui/support/Android.bp
+++ b/confirmationui/support/Android.bp
@@ -46,6 +46,7 @@
"android.hardware.keymaster@4.0",
"libhidlbase",
],
+ test_suites: ["general-tests"],
clang: true,
cflags: [ "-O0" ],
}
diff --git a/contexthub/1.0/vts/functional/Android.bp b/contexthub/1.0/vts/functional/Android.bp
index 7c6e8c7..aef0340 100644
--- a/contexthub/1.0/vts/functional/Android.bp
+++ b/contexthub/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalContexthubV1_0TargetTest.cpp"],
static_libs: ["android.hardware.contexthub@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/drm/1.0/vts/functional/Android.bp b/drm/1.0/vts/functional/Android.bp
index 57678fb..d6ebfdd 100644
--- a/drm/1.0/vts/functional/Android.bp
+++ b/drm/1.0/vts/functional/Android.bp
@@ -32,4 +32,5 @@
"libssl",
"libcrypto",
],
+ test_suites: ["general-tests"],
}
diff --git a/drm/1.1/vts/functional/Android.bp b/drm/1.1/vts/functional/Android.bp
index 782f283..1090b69 100644
--- a/drm/1.1/vts/functional/Android.bp
+++ b/drm/1.1/vts/functional/Android.bp
@@ -31,4 +31,5 @@
"libssl",
"libcrypto",
],
+ test_suites: ["general-tests"],
}
diff --git a/dumpstate/1.0/vts/functional/Android.bp b/dumpstate/1.0/vts/functional/Android.bp
index 1ab530f..fc64d05 100644
--- a/dumpstate/1.0/vts/functional/Android.bp
+++ b/dumpstate/1.0/vts/functional/Android.bp
@@ -18,4 +18,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalDumpstateV1_0TargetTest.cpp"],
static_libs: ["android.hardware.dumpstate@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/gatekeeper/1.0/vts/functional/Android.bp b/gatekeeper/1.0/vts/functional/Android.bp
index aa1da7b..f55e5d2 100644
--- a/gatekeeper/1.0/vts/functional/Android.bp
+++ b/gatekeeper/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalGatekeeperV1_0TargetTest.cpp"],
static_libs: ["android.hardware.gatekeeper@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/gnss/1.0/vts/functional/Android.bp b/gnss/1.0/vts/functional/Android.bp
index d7713db..505cb41 100644
--- a/gnss/1.0/vts/functional/Android.bp
+++ b/gnss/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalGnssV1_0TargetTest.cpp"],
static_libs: ["android.hardware.gnss@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/gnss/1.1/vts/functional/Android.bp b/gnss/1.1/vts/functional/Android.bp
index 67ef486..9892eca 100644
--- a/gnss/1.1/vts/functional/Android.bp
+++ b/gnss/1.1/vts/functional/Android.bp
@@ -26,4 +26,5 @@
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/gnss/2.0/Android.bp b/gnss/2.0/Android.bp
new file mode 100644
index 0000000..39fe97d
--- /dev/null
+++ b/gnss/2.0/Android.bp
@@ -0,0 +1,21 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+ name: "android.hardware.gnss@2.0",
+ root: "android.hardware",
+ vndk: {
+ enabled: true,
+ },
+ srcs: [
+ "IGnss.hal",
+ "IGnssMeasurement.hal",
+ "IGnssMeasurementCallback.hal",
+ ],
+ interfaces: [
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss@1.1",
+ "android.hidl.base@1.0",
+ ],
+ gen_java: true,
+}
+
diff --git a/gnss/2.0/IGnss.hal b/gnss/2.0/IGnss.hal
new file mode 100644
index 0000000..a05f61a
--- /dev/null
+++ b/gnss/2.0/IGnss.hal
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@2.0;
+
+import @1.1::IGnss;
+
+import IGnssMeasurement;
+
+/** Represents the standard GNSS (Global Navigation Satellite System) interface. */
+interface IGnss extends @1.1::IGnss {
+ /**
+ * This method returns the IGnssMeasurement interface.
+ *
+ * Exactly one of getExtensionGnssMeasurement_1_1() and getExtensionGnssMeasurement_2_0() must
+ * return a non-null handle, and the other method must return nullptr.
+ *
+ * @return gnssMeasurementIface Handle to the IGnssMeasurement interface.
+ */
+ getExtensionGnssMeasurement_2_0() generates (IGnssMeasurement gnssMeasurementIface);
+};
\ No newline at end of file
diff --git a/gnss/2.0/IGnssMeasurement.hal b/gnss/2.0/IGnssMeasurement.hal
new file mode 100644
index 0000000..108f3d2
--- /dev/null
+++ b/gnss/2.0/IGnssMeasurement.hal
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@2.0;
+
+import @1.0::IGnssMeasurement;
+import @1.1::IGnssMeasurement;
+import IGnssMeasurementCallback;
+
+/**
+ * Extended interface for GNSS Measurements support.
+ */
+interface IGnssMeasurement extends @1.1::IGnssMeasurement {
+
+ /**
+ * Initializes the interface and registers the callback routines with the HAL. After a
+ * successful call to 'setCallback_2_0' the HAL must begin to provide updates at an average
+ * output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec
+ * can be tolerated.)
+ *
+ * @param callback Handle to GnssMeasurement callback interface.
+ * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode
+ * no clock discontinuities are expected and, when supported, carrier phase should be
+ * continuous in good signal conditions. All non-blacklisted, healthy constellations,
+ * satellites and frequency bands that the chipset supports must be reported in this mode.
+ * The GNSS chipset is allowed to consume more power in this mode. If false, API must behave
+ * as in HAL V1_0, optimizing power via duty cycling, constellations and frequency limits,
+ * etc.
+ *
+ * @return initRet Returns SUCCESS if successful. Returns ERROR_ALREADY_INIT if a callback has
+ * already been registered without a corresponding call to 'close'. Returns ERROR_GENERIC
+ * for any other error. The HAL must not generate any other updates upon returning this
+ * error code.
+ */
+ setCallback_2_0(IGnssMeasurementCallback callback, bool enableFullTracking)
+ generates (GnssMeasurementStatus initRet);
+
+};
diff --git a/gnss/2.0/IGnssMeasurementCallback.hal b/gnss/2.0/IGnssMeasurementCallback.hal
new file mode 100644
index 0000000..226934e
--- /dev/null
+++ b/gnss/2.0/IGnssMeasurementCallback.hal
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+package android.hardware.gnss@2.0;
+
+import @1.0::IGnssMeasurementCallback;
+import @1.1::IGnssMeasurementCallback;
+
+/** The callback interface to report measurements from the HAL. */
+interface IGnssMeasurementCallback extends @1.1::IGnssMeasurementCallback {
+ /**
+ * Enumeration of available values for the GNSS Measurement's code type. Similar to the
+ * Attribute field described in Rinex 3.03, e.g., in Tables 4-10, and Table A2 at the Rinex 3.03
+ * Update 1 Document.
+ */
+ enum GnssMeasurementCodeType : uint8_t {
+ /** GALILEO E1A, GALILEO E6A, IRNSS L5A, IRNSS SA. */
+ CODE_TYPE_A = 0,
+
+ /** GALILEO E1B, GALILEO E6B, IRNSS L5B, IRNSS SB. */
+ CODE_TYPE_B = 1,
+
+ /**
+ * GPS L1 C/A, GPS L2 C/A, GLONASS G1 C/A, GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS
+ * L1 C/A, QZSS L1 C/A, IRNSS L5C.
+ */
+ CODE_TYPE_C = 2,
+
+ /**
+ * GPS L5 I, GLONASS G3 I, GALILEO E5a I, GALILEO E5b I, GALILEO E5a+b I, SBAS L5 I, QZSS L5
+ * I, BDS B1 I, BDS B2 I, BDS B3 I.
+ */
+ CODE_TYPE_I = 3,
+
+ /** GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L), LEX(6) L. */
+ CODE_TYPE_L = 4,
+
+ /** GPS L1M, GPS L2M. */
+ CODE_TYPE_M = 5,
+
+ /** GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P. */
+ CODE_TYPE_P = 6,
+
+ /**
+ * GPS L5 Q, GLONASS G3 Q, GALILEO E5a Q, GALILEO E5b Q, GALILEO E5a+b Q, SBAS L5 Q, QZSS L5
+ * Q, BDS B1 Q, BDS B2 Q, BDS B3 Q.
+ */
+ CODE_TYPE_Q = 7,
+
+ /** GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M), LEX(6) S. */
+ CODE_TYPE_S = 8,
+
+ /** GPS L1 Z-tracking, GPS L2 Z-tracking. */
+ CODE_TYPE_W = 9,
+
+ /**
+ * GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q), GLONASS G3 (I+Q), GALILEO E1 (B+C), GALILEO
+ * E5a (I+Q), GALILEO E5b (I+Q), GALILEO E5a+b(I+Q), GALILEO E6 (B+C), SBAS L5 (I+Q), QZSS
+ * L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q), LEX(6) (S+L), BDS B1 (I+Q), BDS B2 (I+Q), BDS
+ * B3 (I+Q), IRNSS L5 (B+C).
+ */
+ CODE_TYPE_X = 10,
+
+ /** GPS L1Y, GPS L2Y. */
+ CODE_TYPE_Y = 11,
+
+ /** GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), QZSS L1-SAIF. */
+ CODE_TYPE_Z = 12,
+
+ /** GPS L1 codeless, GPS L2 codeless. */
+ CODE_TYPE_CODELESS = 13
+ };
+
+ /**
+ * Extends a GNSS Measurement, adding a GnssMeasurementCodeType.
+ */
+ struct GnssMeasurement {
+ /**
+ * GNSS measurement information for a single satellite and frequency, as in the 1.1
+ * version of the HAL with further clarification of the value reported in the
+ * accumulatedDeltaRangeM field, i.e., the alignment of the phase measurement will not be
+ * adjusted by the receiver so the in-phase and quadrature phase components will have a
+ * quarter cycle offset as they do when transmitted from the satellites. If the measurement
+ * is from a combination of the in-phase and quadrature phase components, then the alignment
+ * of the phase measurement will be aligned to the in-phase component.
+ */
+ @1.1::IGnssMeasurementCallback.GnssMeasurement v1_1;
+
+ /**
+ * The type of code that is currently being tracked in the GNSS measurement.
+ *
+ * For high precision applications the type of code being tracked needs to be considered
+ * in-order to properly apply code specific corrections to the psuedorange measurements.
+ */
+ GnssMeasurementCodeType codeType;
+ };
+
+ /**
+ * Complete set of GNSS Measurement data, same as 1.1 with additional enum in measurements.
+ */
+ struct GnssData {
+ /** The full set of satellite measurement observations. */
+ vec<GnssMeasurement> measurements;
+
+ /** The GNSS clock time reading. */
+ GnssClock clock;
+ };
+
+ /**
+ * Callback for the hal to pass a GnssData structure back to the client.
+ *
+ * @param data Contains a reading of GNSS measurements.
+ */
+ gnssMeasurementCb_2_0(GnssData data);
+};
diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp
new file mode 100644
index 0000000..3c55578
--- /dev/null
+++ b/gnss/2.0/default/Android.bp
@@ -0,0 +1,36 @@
+/*
+ * 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_binary {
+ name: "android.hardware.gnss@2.0-service",
+ init_rc: ["android.hardware.gnss@2.0-service.rc"],
+ relative_install_path: "hw",
+ vendor: true,
+ srcs: [
+ "Gnss.cpp",
+ "GnssMeasurement.cpp",
+ "service.cpp"
+ ],
+ shared_libs: [
+ "libhidlbase",
+ "libhidltransport",
+ "libutils",
+ "liblog",
+ "android.hardware.gnss@2.0",
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss@1.1",
+ ],
+}
diff --git a/gnss/2.0/default/Gnss.cpp b/gnss/2.0/default/Gnss.cpp
new file mode 100644
index 0000000..1170f73
--- /dev/null
+++ b/gnss/2.0/default/Gnss.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "Gnss"
+
+#include "Gnss.h"
+#include <log/log.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+sp<V1_1::IGnssCallback> Gnss::sGnssCallback = nullptr;
+
+// Methods from V1_0::IGnss follow.
+Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>&) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::start() {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::stop() {
+ // TODO implement
+ return bool{};
+}
+
+Return<void> Gnss::cleanup() {
+ // TODO implement
+ return Void();
+}
+
+Return<bool> Gnss::injectTime(int64_t, int64_t, int32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<bool> Gnss::injectLocation(double, double, float) {
+ // TODO implement
+ return bool{};
+}
+
+Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData) {
+ // TODO implement
+ return Void();
+}
+
+Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode,
+ V1_0::IGnss::GnssPositionRecurrence, uint32_t, uint32_t,
+ uint32_t) {
+ // TODO implement
+ return bool{};
+}
+
+Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
+ // TODO implement
+ return sp<V1_0::IAGnssRil>{};
+}
+
+Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
+ // TODO implement
+ return sp<V1_0::IGnssGeofencing>{};
+}
+
+Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
+ // TODO implement
+ return sp<V1_0::IAGnss>{};
+}
+
+Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
+ // TODO implement
+ return sp<V1_0::IGnssNi>{};
+}
+
+Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
+ // TODO implement
+ return sp<V1_0::IGnssMeasurement>{};
+}
+
+Return<sp<V1_0::IGnssNavigationMessage>> Gnss::getExtensionGnssNavigationMessage() {
+ // TODO implement
+ return sp<V1_0::IGnssNavigationMessage>{};
+}
+
+Return<sp<V1_0::IGnssXtra>> Gnss::getExtensionXtra() {
+ // TODO implement
+ return sp<V1_0::IGnssXtra>{};
+}
+
+Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
+ // TODO implement
+ return sp<V1_0::IGnssConfiguration>{};
+}
+
+Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
+ // TODO implement
+ return sp<V1_0::IGnssDebug>{};
+}
+
+Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
+ // TODO implement
+ return sp<V1_0::IGnssBatching>{};
+}
+
+// Methods from V1_1::IGnss follow.
+Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
+ ALOGD("Gnss::setCallback_1_1");
+ if (callback == nullptr) {
+ ALOGE("%s: Null callback ignored", __func__);
+ return false;
+ }
+
+ sGnssCallback = callback;
+
+ uint32_t capabilities = 0x0;
+ auto ret = sGnssCallback->gnssSetCapabilitesCb(capabilities);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
+
+ V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2019};
+
+ ret = sGnssCallback->gnssSetSystemInfoCb(gnssInfo);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
+
+ auto gnssName = "Google Mock GNSS Implementation v2.0";
+ ret = sGnssCallback->gnssNameCb(gnssName);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
+
+ return true;
+}
+
+Return<bool> Gnss::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode,
+ V1_0::IGnss::GnssPositionRecurrence, uint32_t, uint32_t,
+ uint32_t, bool) {
+ // TODO implement
+ return bool{};
+}
+
+Return<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() {
+ // TODO implement
+ return sp<V1_1::IGnssConfiguration>{};
+}
+
+Return<sp<V1_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_1_1() {
+ // TODO implement
+ return sp<V1_1::IGnssMeasurement>{};
+}
+
+Return<bool> Gnss::injectBestLocation(const V1_0::GnssLocation&) {
+ // TODO implement
+ return bool{};
+}
+
+// Methods from V2_0::IGnss follow.
+Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() {
+ // TODO implement
+ return sp<V2_0::IGnssMeasurement>{};
+}
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/2.0/default/Gnss.h b/gnss/2.0/default/Gnss.h
new file mode 100644
index 0000000..17e439f
--- /dev/null
+++ b/gnss/2.0/default/Gnss.h
@@ -0,0 +1,87 @@
+/*
+ * 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_GNSS_V2_0_GNSS_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
+
+#include <android/hardware/gnss/2.0/IGnss.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct Gnss : public IGnss {
+ // Methods from V1_0::IGnss follow.
+ Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
+ Return<bool> start() override;
+ Return<bool> stop() override;
+ Return<void> cleanup() override;
+ Return<bool> injectTime(int64_t timeMs, int64_t timeReferenceMs,
+ int32_t uncertaintyMs) override;
+ Return<bool> injectLocation(double latitudeDegrees, double longitudeDegrees,
+ float accuracyMeters) override;
+ Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override;
+ Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs) override;
+ Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
+ Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override;
+ Return<sp<V1_0::IAGnss>> getExtensionAGnss() override;
+ Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override;
+ Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override;
+ Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override;
+ Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override;
+ Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override;
+ Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override;
+ Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override;
+
+ // Methods from V1_1::IGnss follow.
+ Return<bool> setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) override;
+ Return<bool> setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode,
+ V1_0::IGnss::GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs, bool lowPowerMode) override;
+ Return<sp<V1_1::IGnssConfiguration>> getExtensionGnssConfiguration_1_1() override;
+ Return<sp<V1_1::IGnssMeasurement>> getExtensionGnssMeasurement_1_1() override;
+ Return<bool> injectBestLocation(const V1_0::GnssLocation& location) override;
+
+ // Methods from V2_0::IGnss follow.
+ Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override;
+
+ private:
+ static sp<V1_1::IGnssCallback> sGnssCallback;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
diff --git a/gnss/2.0/default/GnssMeasurement.cpp b/gnss/2.0/default/GnssMeasurement.cpp
new file mode 100644
index 0000000..fbcdc12
--- /dev/null
+++ b/gnss/2.0/default/GnssMeasurement.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "GnssMeasurement.h"
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+// Methods from V1_0::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>&) {
+ // TODO implement
+ return V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+Return<void> GnssMeasurement::close() {
+ // TODO implement
+ return Void();
+}
+
+// Methods from V1_1::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_1_1(
+ const sp<V1_1::IGnssMeasurementCallback>&, bool) {
+ // TODO implement
+ return V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+// Methods from V2_0::IGnssMeasurement follow.
+Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>&, bool) {
+ // TODO implement
+ return V1_0::IGnssMeasurement::GnssMeasurementStatus{};
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+
+// IGnssMeasurement* HIDL_FETCH_IGnssMeasurement(const char* /* name */) {
+// return new GnssMeasurement();
+//}
+//
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
diff --git a/gnss/2.0/default/GnssMeasurement.h b/gnss/2.0/default/GnssMeasurement.h
new file mode 100644
index 0000000..8c621bb
--- /dev/null
+++ b/gnss/2.0/default/GnssMeasurement.h
@@ -0,0 +1,59 @@
+/*
+ * 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_GNSS_V2_0_GNSSMEASUREMENT_H
+#define ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
+
+#include <android/hardware/gnss/2.0/IGnssMeasurement.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct GnssMeasurement : public IGnssMeasurement {
+ // Methods from V1_0::IGnssMeasurement follow.
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback(
+ const sp<V1_0::IGnssMeasurementCallback>& callback) override;
+ Return<void> close() override;
+
+ // Methods from V1_1::IGnssMeasurement follow.
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_1_1(
+ const sp<V1_1::IGnssMeasurementCallback>& callback, bool enableFullTracking) override;
+
+ // Methods from V2_0::IGnssMeasurement follow.
+ Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_2_0(
+ const sp<V2_0::IGnssMeasurementCallback>& callback, bool enableFullTracking) override;
+};
+
+} // namespace implementation
+} // namespace V2_0
+} // namespace gnss
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H
diff --git a/gnss/2.0/default/OWNERS b/gnss/2.0/default/OWNERS
new file mode 100644
index 0000000..8da956c
--- /dev/null
+++ b/gnss/2.0/default/OWNERS
@@ -0,0 +1,5 @@
+wyattriley@google.com
+gomo@google.com
+smalkos@google.com
+yuhany@google.com
+aadmal@google.com
diff --git a/gnss/2.0/default/android.hardware.gnss@2.0-service.rc b/gnss/2.0/default/android.hardware.gnss@2.0-service.rc
new file mode 100644
index 0000000..a27240d
--- /dev/null
+++ b/gnss/2.0/default/android.hardware.gnss@2.0-service.rc
@@ -0,0 +1,4 @@
+service vendor.gnss-2-0 /vendor/bin/hw/android.hardware.gnss@2.0-service
+ class hal
+ user system
+ group system
diff --git a/gnss/2.0/default/service.cpp b/gnss/2.0/default/service.cpp
new file mode 100644
index 0000000..301d181
--- /dev/null
+++ b/gnss/2.0/default/service.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "android.hardware.gnss@2.0-service"
+
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+#include "Gnss.h"
+
+using ::android::OK;
+using ::android::sp;
+using ::android::hardware::configureRpcThreadpool;
+using ::android::hardware::joinRpcThreadpool;
+using ::android::hardware::gnss::V2_0::IGnss;
+using ::android::hardware::gnss::V2_0::implementation::Gnss;
+
+int main(int /* argc */, char* /* argv */ []) {
+ sp<IGnss> gnss = new Gnss();
+ configureRpcThreadpool(1, true /* will join */);
+ if (gnss->registerAsService() != OK) {
+ ALOGE("Could not register gnss 2.0 service.");
+ return 1;
+ }
+ joinRpcThreadpool();
+
+ ALOGE("Service exited!");
+ return 1;
+}
diff --git a/gnss/2.0/vts/OWNERS b/gnss/2.0/vts/OWNERS
new file mode 100644
index 0000000..0a7ce6c
--- /dev/null
+++ b/gnss/2.0/vts/OWNERS
@@ -0,0 +1,8 @@
+wyattriley@google.com
+gomo@google.com
+smalkos@google.com
+yuhany@google.com
+aadmal@google.com
+
+# VTS team
+yim@google.com
diff --git a/audio/core/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp
similarity index 63%
rename from audio/core/2.0/vts/functional/Android.bp
rename to gnss/2.0/vts/functional/Android.bp
index d1ddaff..7db142f 100644
--- a/audio/core/2.0/vts/functional/Android.bp
+++ b/gnss/2.0/vts/functional/Android.bp
@@ -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.
@@ -15,18 +15,16 @@
//
cc_test {
- name: "VtsHalAudioV2_0TargetTest",
+ name: "VtsHalGnssV2_0TargetTest",
defaults: ["VtsHalTargetTestDefaults"],
srcs: [
- "AudioPrimaryHidlHalTest.cpp",
- "ValidateAudioConfiguration.cpp"
+ "gnss_hal_test.cpp",
+ "gnss_hal_test_cases.cpp",
+ "VtsHalGnssV2_0TargetTest.cpp",
],
static_libs: [
- "android.hardware.audio.common.test.utility",
- "android.hardware.audio@2.0",
- "android.hardware.audio.common@2.0",
- "libicuuc",
- "libicuuc_stubdata",
- "libxml2",
+ "android.hardware.gnss@1.0",
+ "android.hardware.gnss@1.1",
+ "android.hardware.gnss@2.0",
],
}
diff --git a/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp b/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp
new file mode 100644
index 0000000..ae36c50
--- /dev/null
+++ b/gnss/2.0/vts/functional/VtsHalGnssV2_0TargetTest.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "VtsHalGnssV2_0TargetTest"
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include "gnss_hal_test.h"
+
+int main(int argc, char** argv) {
+ ::testing::AddGlobalTestEnvironment(GnssHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ GnssHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.cpp b/gnss/2.0/vts/functional/gnss_hal_test.cpp
new file mode 100644
index 0000000..d7101a0
--- /dev/null
+++ b/gnss/2.0/vts/functional/gnss_hal_test.cpp
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssHalTest"
+
+#include <gnss_hal_test.h>
+
+#include <chrono>
+
+// Implementations for the main test class for GNSS HAL
+GnssHalTest::GnssHalTest()
+ : info_called_count_(0),
+ capabilities_called_count_(0),
+ location_called_count_(0),
+ name_called_count_(0),
+ notify_count_(0) {}
+
+void GnssHalTest::SetUp() {
+ gnss_hal_ = ::testing::VtsHalHidlTargetTestBase::getService<IGnss>(
+ GnssHidlEnvironment::Instance()->getServiceName<IGnss>());
+ list_gnss_sv_status_.clear();
+ ASSERT_NE(gnss_hal_, nullptr);
+
+ SetUpGnssCallback();
+}
+
+void GnssHalTest::TearDown() {
+ if (gnss_hal_ != nullptr) {
+ gnss_hal_->cleanup();
+ }
+ if (notify_count_ > 0) {
+ ALOGW("%d unprocessed callbacks discarded", notify_count_);
+ }
+}
+
+void GnssHalTest::SetUpGnssCallback() {
+ gnss_cb_ = new GnssCallback(*this);
+ ASSERT_NE(gnss_cb_, nullptr);
+
+ auto result = gnss_hal_->setCallback_1_1(gnss_cb_);
+ if (!result.isOk()) {
+ ALOGE("result of failed setCallback %s", result.description().c_str());
+ }
+
+ ASSERT_TRUE(result.isOk());
+ ASSERT_TRUE(result);
+
+ /*
+ * All capabilities, name and systemInfo callbacks should trigger
+ */
+ EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+ EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+ EXPECT_EQ(std::cv_status::no_timeout, wait(TIMEOUT_SEC));
+
+ EXPECT_EQ(capabilities_called_count_, 1);
+ EXPECT_EQ(info_called_count_, 1);
+ EXPECT_EQ(name_called_count_, 1);
+}
+
+void GnssHalTest::notify() {
+ std::unique_lock<std::mutex> lock(mtx_);
+ notify_count_++;
+ cv_.notify_one();
+}
+
+std::cv_status GnssHalTest::wait(int timeout_seconds) {
+ std::unique_lock<std::mutex> lock(mtx_);
+
+ auto status = std::cv_status::no_timeout;
+ while (notify_count_ == 0) {
+ status = cv_.wait_for(lock, std::chrono::seconds(timeout_seconds));
+ if (status == std::cv_status::timeout) return status;
+ }
+ notify_count_--;
+ return status;
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSetSystemInfoCb(
+ const IGnssCallback::GnssSystemInfo& info) {
+ ALOGI("Info received, year %d", info.yearOfHw);
+ parent_.info_called_count_++;
+ parent_.last_info_ = info;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSetCapabilitesCb(uint32_t capabilities) {
+ ALOGI("Capabilities received %d", capabilities);
+ parent_.capabilities_called_count_++;
+ parent_.last_capabilities_ = capabilities;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssNameCb(const android::hardware::hidl_string& name) {
+ ALOGI("Name received: %s", name.c_str());
+ parent_.name_called_count_++;
+ parent_.last_name_ = name;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssLocationCb(const GnssLocation& location) {
+ ALOGI("Location received");
+ parent_.location_called_count_++;
+ parent_.last_location_ = location;
+ parent_.notify();
+ return Void();
+}
+
+Return<void> GnssHalTest::GnssCallback::gnssSvStatusCb(
+ const IGnssCallback::GnssSvStatus& svStatus) {
+ ALOGI("GnssSvStatus received");
+ parent_.list_gnss_sv_status_.emplace_back(svStatus);
+ return Void();
+}
diff --git a/gnss/2.0/vts/functional/gnss_hal_test.h b/gnss/2.0/vts/functional/gnss_hal_test.h
new file mode 100644
index 0000000..64f3575
--- /dev/null
+++ b/gnss/2.0/vts/functional/gnss_hal_test.h
@@ -0,0 +1,132 @@
+/*
+ * 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 GNSS_HAL_TEST_H_
+#define GNSS_HAL_TEST_H_
+
+#include <android/hardware/gnss/2.0/IGnss.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <VtsHalHidlTargetTestEnvBase.h>
+
+#include <condition_variable>
+#include <list>
+#include <mutex>
+
+using android::hardware::Return;
+using android::hardware::Void;
+
+using android::hardware::gnss::V1_0::GnssLocation;
+
+using android::hardware::gnss::V1_0::GnssLocationFlags;
+using android::hardware::gnss::V1_1::IGnssCallback;
+using android::hardware::gnss::V2_0::IGnss;
+
+using android::sp;
+
+#define TIMEOUT_SEC 2 // for basic commands/responses
+
+// Test environment for GNSS HIDL HAL.
+class GnssHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static GnssHidlEnvironment* Instance() {
+ static GnssHidlEnvironment* instance = new GnssHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override { registerTestService<IGnss>(); }
+
+ private:
+ GnssHidlEnvironment() {}
+};
+
+// The main test class for GNSS HAL.
+class GnssHalTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ GnssHalTest();
+
+ virtual void SetUp() override;
+
+ virtual void TearDown() override;
+
+ /* Used as a mechanism to inform the test that a callback has occurred */
+ void notify();
+
+ /* Test code calls this function to wait for a callback */
+ std::cv_status wait(int timeout_seconds);
+
+ /* Callback class for data & Event. */
+ class GnssCallback : public IGnssCallback {
+ public:
+ GnssHalTest& parent_;
+
+ GnssCallback(GnssHalTest& parent) : parent_(parent){};
+
+ virtual ~GnssCallback() = default;
+
+ // Dummy callback handlers
+ Return<void> gnssStatusCb(const IGnssCallback::GnssStatusValue /* status */) override {
+ return Void();
+ }
+ Return<void> gnssNmeaCb(int64_t /* timestamp */,
+ const android::hardware::hidl_string& /* nmea */) override {
+ return Void();
+ }
+ Return<void> gnssAcquireWakelockCb() override { return Void(); }
+ Return<void> gnssReleaseWakelockCb() override { return Void(); }
+ Return<void> gnssRequestLocationCb(bool /* independentFromGnss */) override {
+ return Void();
+ }
+ Return<void> gnssRequestTimeCb() override { return Void(); }
+ // Actual (test) callback handlers
+ Return<void> gnssNameCb(const android::hardware::hidl_string& name) override;
+ Return<void> gnssLocationCb(const GnssLocation& location) override;
+ Return<void> gnssSetCapabilitesCb(uint32_t capabilities) override;
+ Return<void> gnssSetSystemInfoCb(const IGnssCallback::GnssSystemInfo& info) override;
+ Return<void> gnssSvStatusCb(const IGnssCallback::GnssSvStatus& svStatus) override;
+ };
+
+ /*
+ * SetUpGnssCallback:
+ * Set GnssCallback and verify the result.
+ */
+ void SetUpGnssCallback();
+
+ sp<IGnss> gnss_hal_; // GNSS HAL to call into
+ sp<IGnssCallback> gnss_cb_; // Primary callback interface
+
+ /* Count of calls to set the following items, and the latest item (used by
+ * test.)
+ */
+ int info_called_count_;
+ IGnssCallback::GnssSystemInfo last_info_;
+ uint32_t last_capabilities_;
+ int capabilities_called_count_;
+ int location_called_count_;
+ GnssLocation last_location_;
+ list<IGnssCallback::GnssSvStatus> list_gnss_sv_status_;
+
+ int name_called_count_;
+ android::hardware::hidl_string last_name_;
+
+ private:
+ std::mutex mtx_;
+ std::condition_variable cv_;
+ int notify_count_;
+};
+
+#endif // GNSS_HAL_TEST_H_
diff --git a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
new file mode 100644
index 0000000..12a15e8
--- /dev/null
+++ b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "GnssHalTestCases"
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <gnss_hal_test.h>
+
+using android::hardware::hidl_vec;
+
+using IGnssMeasurement_2_0 = android::hardware::gnss::V2_0::IGnssMeasurement;
+using IGnssMeasurement_1_1 = android::hardware::gnss::V1_1::IGnssMeasurement;
+
+/*
+ * SetupTeardownCreateCleanup:
+ * Requests the gnss HAL then calls cleanup
+ *
+ * Empty test fixture to verify basic Setup & Teardown
+ */
+TEST_F(GnssHalTest, SetupTeardownCreateCleanup) {}
+
+/*
+ * TestGnssMeasurementCallback:
+ * Gets the GnssMeasurementExtension and verify that it returns an actual extension.
+ */
+TEST_F(GnssHalTest, TestGnssMeasurementCallback) {
+ auto gnssMeasurement_2_0 = gnss_hal_->getExtensionGnssMeasurement_2_0();
+ auto gnssMeasurement_1_1 = gnss_hal_->getExtensionGnssMeasurement_1_1();
+ ASSERT_TRUE(gnssMeasurement_2_0.isOk() || gnssMeasurement_1_1.isOk());
+ if (last_capabilities_ & IGnssCallback::Capabilities::MEASUREMENTS) {
+ sp<IGnssMeasurement_2_0> iGnssMeas_2_0 = gnssMeasurement_2_0;
+ sp<IGnssMeasurement_1_1> iGnssMeas_1_1 = gnssMeasurement_1_1;
+ // Exactly one interface is non-null.
+ ASSERT_TRUE((iGnssMeas_1_1 != nullptr) != (iGnssMeas_2_0 != nullptr));
+ }
+}
diff --git a/graphics/composer/2.1/vts/functional/Android.bp b/graphics/composer/2.1/vts/functional/Android.bp
index 8e346df..c98cc0d 100644
--- a/graphics/composer/2.1/vts/functional/Android.bp
+++ b/graphics/composer/2.1/vts/functional/Android.bp
@@ -34,4 +34,5 @@
header_libs: [
"android.hardware.graphics.composer@2.1-command-buffer",
],
+ test_suites: ["general-tests"],
}
diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp
index acc9245..b62f302 100644
--- a/graphics/composer/2.2/vts/functional/Android.bp
+++ b/graphics/composer/2.2/vts/functional/Android.bp
@@ -44,4 +44,5 @@
"android.hardware.graphics.composer@2.1-command-buffer",
"android.hardware.graphics.composer@2.2-command-buffer",
],
+ test_suites: ["general-tests"],
}
diff --git a/graphics/composer/2.3/IComposerClient.hal b/graphics/composer/2.3/IComposerClient.hal
index 7856658..87002ec 100644
--- a/graphics/composer/2.3/IComposerClient.hal
+++ b/graphics/composer/2.3/IComposerClient.hal
@@ -27,6 +27,42 @@
interface IComposerClient extends @2.2::IComposerClient {
+ // TODO: Move this enum to LLNDK after we decide where to put graphic types.
+ /**
+ * Required capabilities which are supported by the display. The
+ * particular set of supported capabilities for a given display may be
+ * retrieved using getDisplayCapabilities.
+ */
+ enum DisplayCapability : uint32_t {
+ INVALID = 0,
+
+ /**
+ * Specifies that the display must a color transform even when
+ * either the client or the device has chosen that all layers should
+ * be composed by the client. This prevents the client from applying
+ * the color transform during its composition step.
+ * If getDisplayCapabilities is supported, the global capability
+ * SKIP_CLIENT_COLOR_TRANSFORM is ignored.
+ * If getDisplayCapabilities is not supported, and the global capability
+ * SKIP_CLIENT_COLOR_TRANSFORM is returned by getCapabilities,
+ * then all displays must be treated as having
+ * SKIP_CLIENT_COLOR_TRANSFORM.
+ */
+ SKIP_CLIENT_COLOR_TRANSFORM = 1,
+
+ /**
+ * Specifies that the display supports PowerMode::DOZE and
+ * PowerMode::DOZE_SUSPEND. DOZE_SUSPEND may not provide any benefit
+ * over DOZE (see the definition of PowerMode for more information),
+ * but if both DOZE and DOZE_SUSPEND are no different from
+ * PowerMode::ON, the device must not claim support.
+ * Must be returned by getDisplayCapabilities when getDozeSupport
+ * indicates the display supports PowerMode::DOZE and
+ * PowerMode::DOZE_SUSPEND.
+ */
+ DOZE = 2,
+ };
+
enum Command : @2.2::IComposerClient.Command {
/**
* SET_LAYER_COLOR_TRANSFORM has this pseudo prototype
@@ -350,4 +386,17 @@
*/
setColorMode_2_3(Display display, ColorMode mode, RenderIntent intent)
generates (Error error);
+
+ /**
+ * Provides a list of supported capabilities (as described in the
+ * definition of DisplayCapability above). This list must not change after
+ * initialization.
+ *
+ * @return error is NONE upon success. Otherwise,
+ * BAD_DISPLAY when an invalid display handle was passed in.
+ * @return capabilities is a list of supported capabilities.
+ */
+ getDisplayCapabilities(Display display)
+ generates (Error error,
+ vec<DisplayCapability> capabilities);
};
diff --git a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h
index be0ef4c..69872d2 100644
--- a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h
+++ b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerClient.h
@@ -73,6 +73,14 @@
return err;
}
+ Return<void> getDisplayCapabilities(
+ Display display, IComposerClient::getDisplayCapabilities_cb hidl_cb) override {
+ hidl_vec<IComposerClient::DisplayCapability> capabilities;
+ Error error = mHal->getDisplayCapabilities(display, &capabilities);
+ hidl_cb(error, capabilities);
+ return Void();
+ }
+
static std::unique_ptr<ComposerClientImpl> create(Hal* hal) {
auto client = std::make_unique<ComposerClientImpl>(hal);
return client->init() ? std::move(client) : nullptr;
diff --git a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h
index 8ca5d75..c7de848 100644
--- a/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h
+++ b/graphics/composer/2.3/utils/hal/include/composer-hal/2.3/ComposerHal.h
@@ -84,6 +84,8 @@
hidl_vec<uint64_t>& sampleComponent1,
hidl_vec<uint64_t>& sampleComponent2,
hidl_vec<uint64_t>& sampleComponent3) = 0;
+ virtual Error getDisplayCapabilities(
+ Display display, hidl_vec<IComposerClient::DisplayCapability>* outCapabilities) = 0;
};
} // namespace hal
diff --git a/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h b/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
index 8d444c8..f7ce7e8 100644
--- a/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
+++ b/graphics/composer/2.3/utils/passthrough/include/composer-passthrough/2.3/HwcHal.h
@@ -163,6 +163,29 @@
return static_cast<Error>(errorRaw);
}
+ Error getDisplayCapabilities(
+ Display display, hidl_vec<IComposerClient::DisplayCapability>* outCapabilities) override {
+ if (!mDispatch.getDisplayCapabilities) {
+ return Error::UNSUPPORTED;
+ }
+
+ uint32_t count = 0;
+ int32_t error = mDispatch.getDisplayCapabilities(mDevice, display, &count, nullptr);
+ if (error != HWC2_ERROR_NONE) {
+ return static_cast<Error>(error);
+ }
+ outCapabilities->resize(count);
+ error = mDispatch.getDisplayCapabilities(
+ mDevice, display, &count,
+ reinterpret_cast<std::underlying_type<IComposerClient::DisplayCapability>::type*>(
+ outCapabilities->data()));
+ if (error != HWC2_ERROR_NONE) {
+ *outCapabilities = hidl_vec<IComposerClient::DisplayCapability>();
+ return static_cast<Error>(error);
+ }
+ return Error::NONE;
+ }
+
protected:
bool initDispatch() override {
if (!BaseType2_2::initDispatch()) {
@@ -179,6 +202,8 @@
&mDispatch.setDisplayedContentSamplingEnabled);
this->initOptionalDispatch(HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE,
&mDispatch.getDisplayedContentSample);
+ this->initOptionalDispatch(HWC2_FUNCTION_GET_DISPLAY_CAPABILITIES,
+ &mDispatch.getDisplayCapabilities);
return true;
}
@@ -189,6 +214,7 @@
HWC2_PFN_GET_DISPLAYED_CONTENT_SAMPLING_ATTRIBUTES getDisplayedContentSamplingAttributes;
HWC2_PFN_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED setDisplayedContentSamplingEnabled;
HWC2_PFN_GET_DISPLAYED_CONTENT_SAMPLE getDisplayedContentSample;
+ HWC2_PFN_GET_DISPLAY_CAPABILITIES getDisplayCapabilities;
} mDispatch = {};
using BaseType2_2 = V2_2::passthrough::detail::HwcHalImpl<Hal>;
diff --git a/graphics/composer/2.3/utils/vts/ComposerVts.cpp b/graphics/composer/2.3/utils/vts/ComposerVts.cpp
index 9304992..c631c50 100644
--- a/graphics/composer/2.3/utils/vts/ComposerVts.cpp
+++ b/graphics/composer/2.3/utils/vts/ComposerVts.cpp
@@ -150,6 +150,15 @@
return error;
}
+std::vector<IComposerClient::DisplayCapability> ComposerClient::getDisplayCapabilities(
+ Display display) {
+ std::vector<IComposerClient::DisplayCapability> capabilities;
+ mClient->getDisplayCapabilities(
+ display, [&](const auto&, const auto& tmpCapabilities) { capabilities = tmpCapabilities; });
+
+ return capabilities;
+}
+
} // namespace vts
} // namespace V2_3
} // namespace composer
diff --git a/graphics/composer/2.3/utils/vts/include/composer-vts/2.3/ComposerVts.h b/graphics/composer/2.3/utils/vts/include/composer-vts/2.3/ComposerVts.h
index 4b9c955..d3aa779 100644
--- a/graphics/composer/2.3/utils/vts/include/composer-vts/2.3/ComposerVts.h
+++ b/graphics/composer/2.3/utils/vts/include/composer-vts/2.3/ComposerVts.h
@@ -91,6 +91,7 @@
bool getClientTargetSupport_2_3(Display display, uint32_t width, uint32_t height,
PixelFormat format, Dataspace dataspace);
+ std::vector<IComposerClient::DisplayCapability> getDisplayCapabilities(Display display);
private:
const sp<IComposerClient> mClient;
diff --git a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
index a294825..6c5cb5d 100644
--- a/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
+++ b/graphics/composer/2.3/vts/functional/VtsHalGraphicsComposerV2_3TargetTest.cpp
@@ -427,6 +427,23 @@
}
}
+/*
+ * getDisplayCapabilities is required in composer 2.3
+ * Test some constraints.
+ */
+TEST_F(GraphicsComposerHidlTest, getDisplayCapabilitiesBasic) {
+ auto capabilities = mComposerClient->getDisplayCapabilities(mPrimaryDisplay);
+ bool hasDozeSupport = std::find(capabilities.begin(), capabilities.end(),
+ IComposerClient::DisplayCapability::DOZE) != capabilities.end();
+ EXPECT_EQ(mComposerClient->getDozeSupport(mPrimaryDisplay), hasDozeSupport);
+}
+
+TEST_F(GraphicsComposerHidlTest, getDisplayCapabilitiesBadDisplay) {
+ mComposerClient->getRaw()->getDisplayCapabilities(
+ mInvalidDisplayId,
+ [&](const auto& tmpError, const auto&) { EXPECT_EQ(Error::BAD_DISPLAY, tmpError); });
+}
+
} // namespace
} // namespace vts
} // namespace V2_3
diff --git a/graphics/mapper/2.0/vts/functional/Android.bp b/graphics/mapper/2.0/vts/functional/Android.bp
index 969317a..853c2a3 100644
--- a/graphics/mapper/2.0/vts/functional/Android.bp
+++ b/graphics/mapper/2.0/vts/functional/Android.bp
@@ -24,4 +24,5 @@
"android.hardware.graphics.mapper@2.0",
"android.hardware.graphics.mapper@2.0-vts",
],
+ test_suites: ["general-tests"],
}
diff --git a/graphics/mapper/2.1/vts/functional/Android.bp b/graphics/mapper/2.1/vts/functional/Android.bp
index ac67af8..afd8e7f 100644
--- a/graphics/mapper/2.1/vts/functional/Android.bp
+++ b/graphics/mapper/2.1/vts/functional/Android.bp
@@ -26,4 +26,5 @@
"android.hardware.graphics.mapper@2.0-vts",
"android.hardware.graphics.mapper@2.1-vts",
],
+ test_suites: ["general-tests"],
}
diff --git a/health/1.0/vts/functional/Android.bp b/health/1.0/vts/functional/Android.bp
index 8742651..c14dcee 100644
--- a/health/1.0/vts/functional/Android.bp
+++ b/health/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalHealthV1_0TargetTest.cpp"],
static_libs: ["android.hardware.health@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/health/2.0/vts/functional/Android.bp b/health/2.0/vts/functional/Android.bp
index 4ad01b9..3544e5f 100644
--- a/health/2.0/vts/functional/Android.bp
+++ b/health/2.0/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.health@1.0",
"android.hardware.health@2.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/health/storage/1.0/vts/functional/Android.bp b/health/storage/1.0/vts/functional/Android.bp
index 63591cf..250a7dc 100644
--- a/health/storage/1.0/vts/functional/Android.bp
+++ b/health/storage/1.0/vts/functional/Android.bp
@@ -22,5 +22,6 @@
shared_libs: [
"libhidltransport"
],
+ test_suites: ["general-tests"],
}
diff --git a/ir/1.0/vts/functional/Android.bp b/ir/1.0/vts/functional/Android.bp
index 2a86f8e..f5c9d61 100644
--- a/ir/1.0/vts/functional/Android.bp
+++ b/ir/1.0/vts/functional/Android.bp
@@ -21,4 +21,5 @@
static_libs: [
"android.hardware.ir@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/keymaster/3.0/vts/functional/Android.bp b/keymaster/3.0/vts/functional/Android.bp
index 7d96704..b0371c7 100644
--- a/keymaster/3.0/vts/functional/Android.bp
+++ b/keymaster/3.0/vts/functional/Android.bp
@@ -29,4 +29,5 @@
"libcrypto",
"libsoftkeymasterdevice",
],
+ test_suites: ["general-tests"],
}
diff --git a/keymaster/4.0/vts/functional/Android.bp b/keymaster/4.0/vts/functional/Android.bp
index d74a16f..333e408 100644
--- a/keymaster/4.0/vts/functional/Android.bp
+++ b/keymaster/4.0/vts/functional/Android.bp
@@ -29,4 +29,5 @@
"libkeymaster4support",
"libsoftkeymasterdevice",
],
+ test_suites: ["general-tests"],
}
diff --git a/light/2.0/vts/functional/Android.bp b/light/2.0/vts/functional/Android.bp
index e0ec4cf..9f03d27 100644
--- a/light/2.0/vts/functional/Android.bp
+++ b/light/2.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalLightV2_0TargetTest.cpp"],
static_libs: ["android.hardware.light@2.0"],
+ test_suites: ["general-tests"],
}
diff --git a/media/omx/1.0/vts/functional/audio/Android.bp b/media/omx/1.0/vts/functional/audio/Android.bp
index f517fa1..7418bb4 100644
--- a/media/omx/1.0/vts/functional/audio/Android.bp
+++ b/media/omx/1.0/vts/functional/audio/Android.bp
@@ -21,6 +21,7 @@
"VtsHalMediaOmxV1_0TargetAudioEncTest.cpp",
"media_audio_hidl_test_common.cpp"
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -30,6 +31,7 @@
"VtsHalMediaOmxV1_0TargetAudioDecTest.cpp",
"media_audio_hidl_test_common.cpp"
],
+ test_suites: ["general-tests"],
}
diff --git a/media/omx/1.0/vts/functional/component/Android.bp b/media/omx/1.0/vts/functional/component/Android.bp
index f76b6e9..970eabe 100644
--- a/media/omx/1.0/vts/functional/component/Android.bp
+++ b/media/omx/1.0/vts/functional/component/Android.bp
@@ -18,5 +18,6 @@
name: "VtsHalMediaOmxV1_0TargetComponentTest",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: ["VtsHalMediaOmxV1_0TargetComponentTest.cpp"],
+ test_suites: ["general-tests"],
}
diff --git a/media/omx/1.0/vts/functional/master/Android.bp b/media/omx/1.0/vts/functional/master/Android.bp
index 4a45e69..cf3f15d 100644
--- a/media/omx/1.0/vts/functional/master/Android.bp
+++ b/media/omx/1.0/vts/functional/master/Android.bp
@@ -18,5 +18,6 @@
name: "VtsHalMediaOmxV1_0TargetMasterTest",
defaults: ["VtsHalMediaOmxV1_0Defaults"],
srcs: ["VtsHalMediaOmxV1_0TargetMasterTest.cpp"],
+ test_suites: ["general-tests"],
}
diff --git a/media/omx/1.0/vts/functional/video/Android.bp b/media/omx/1.0/vts/functional/video/Android.bp
index f0da2b3..c7e0424 100644
--- a/media/omx/1.0/vts/functional/video/Android.bp
+++ b/media/omx/1.0/vts/functional/video/Android.bp
@@ -21,6 +21,7 @@
"VtsHalMediaOmxV1_0TargetVideoDecTest.cpp",
"media_video_hidl_test_common.cpp"
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -33,4 +34,5 @@
static_libs: [
"libnativewindow",
],
+ test_suites: ["general-tests"],
}
diff --git a/memtrack/1.0/vts/functional/Android.bp b/memtrack/1.0/vts/functional/Android.bp
index 2d833e7..d682e0b 100644
--- a/memtrack/1.0/vts/functional/Android.bp
+++ b/memtrack/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalMemtrackV1_0TargetTest.cpp"],
static_libs: ["android.hardware.memtrack@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.0/vts/functional/Android.bp b/neuralnetworks/1.0/vts/functional/Android.bp
index 234527a..dd6f934 100644
--- a/neuralnetworks/1.0/vts/functional/Android.bp
+++ b/neuralnetworks/1.0/vts/functional/Android.bp
@@ -81,4 +81,5 @@
"BasicTests.cpp",
"GeneratedTests.cpp",
],
+ test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.1/vts/functional/Android.bp b/neuralnetworks/1.1/vts/functional/Android.bp
index 07c9b6e..3f0c256 100644
--- a/neuralnetworks/1.1/vts/functional/Android.bp
+++ b/neuralnetworks/1.1/vts/functional/Android.bp
@@ -21,6 +21,7 @@
srcs: [
"GeneratedTestsV1_0.cpp",
],
+ test_suites: ["general-tests"],
}
// Tests for V1_1 models.
@@ -31,4 +32,5 @@
"BasicTests.cpp",
"GeneratedTests.cpp",
],
+ test_suites: ["general-tests"],
}
diff --git a/neuralnetworks/1.2/Android.bp b/neuralnetworks/1.2/Android.bp
index 5a661e0..e155bbd 100644
--- a/neuralnetworks/1.2/Android.bp
+++ b/neuralnetworks/1.2/Android.bp
@@ -19,8 +19,10 @@
"Model",
"Operand",
"OperandType",
+ "OperandTypeRange",
"Operation",
"OperationType",
+ "OperationTypeRange",
],
gen_java: false,
}
diff --git a/neuralnetworks/1.2/vts/functional/Android.bp b/neuralnetworks/1.2/vts/functional/Android.bp
index 085d5db..5b119ee 100644
--- a/neuralnetworks/1.2/vts/functional/Android.bp
+++ b/neuralnetworks/1.2/vts/functional/Android.bp
@@ -20,7 +20,8 @@
defaults: ["VtsHalNeuralNetworksTargetTestDefaults"],
srcs: [
"GeneratedTestsV1_0.cpp",
- ]
+ ],
+ test_suites: ["general-tests"],
}
// Tests for V1_1 models using the V1_2 HAL.
@@ -30,6 +31,7 @@
srcs: [
"GeneratedTestsV1_1.cpp",
],
+ test_suites: ["general-tests"],
}
// Tests for V1_2 models.
@@ -40,4 +42,5 @@
"BasicTests.cpp",
"GeneratedTests.cpp",
],
+ test_suites: ["general-tests"],
}
diff --git a/nfc/1.0/vts/functional/Android.bp b/nfc/1.0/vts/functional/Android.bp
index 3861bd4..c2e365e 100644
--- a/nfc/1.0/vts/functional/Android.bp
+++ b/nfc/1.0/vts/functional/Android.bp
@@ -21,4 +21,5 @@
static_libs: [
"android.hardware.nfc@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/nfc/1.1/vts/functional/Android.bp b/nfc/1.1/vts/functional/Android.bp
index 0ce531f..6698c5a 100644
--- a/nfc/1.1/vts/functional/Android.bp
+++ b/nfc/1.1/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.nfc@1.0",
"android.hardware.nfc@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/oemlock/1.0/vts/functional/Android.bp b/oemlock/1.0/vts/functional/Android.bp
index 20737a1..28d6bf6 100644
--- a/oemlock/1.0/vts/functional/Android.bp
+++ b/oemlock/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalOemLockV1_0TargetTest.cpp"],
static_libs: ["android.hardware.oemlock@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/power/1.0/vts/functional/Android.bp b/power/1.0/vts/functional/Android.bp
index 45f74fc..a716f02 100644
--- a/power/1.0/vts/functional/Android.bp
+++ b/power/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalPowerV1_0TargetTest.cpp"],
static_libs: ["android.hardware.power@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/power/1.1/vts/functional/Android.bp b/power/1.1/vts/functional/Android.bp
index 604cd36..de75984 100644
--- a/power/1.1/vts/functional/Android.bp
+++ b/power/1.1/vts/functional/Android.bp
@@ -22,4 +22,5 @@
"android.hardware.power@1.0",
"android.hardware.power@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/power/1.2/vts/functional/Android.bp b/power/1.2/vts/functional/Android.bp
index d615e85..f424bfa 100644
--- a/power/1.2/vts/functional/Android.bp
+++ b/power/1.2/vts/functional/Android.bp
@@ -23,4 +23,5 @@
"android.hardware.power@1.1",
"android.hardware.power@1.2",
],
+ test_suites: ["general-tests"],
}
diff --git a/power/1.3/vts/functional/Android.bp b/power/1.3/vts/functional/Android.bp
index 34cdb60..06f6e7a 100644
--- a/power/1.3/vts/functional/Android.bp
+++ b/power/1.3/vts/functional/Android.bp
@@ -24,4 +24,5 @@
"android.hardware.power@1.2",
"android.hardware.power@1.3",
],
+ test_suites: ["general-tests"],
}
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp
index afbb1c4..9dec2f2 100644
--- a/radio/1.0/vts/functional/Android.bp
+++ b/radio/1.0/vts/functional/Android.bp
@@ -33,6 +33,7 @@
static_libs: [
"android.hardware.radio@1.0",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -46,6 +47,7 @@
static_libs: [
"android.hardware.radio@1.0",
],
+ test_suites: ["general-tests"],
}
cc_library_static {
diff --git a/radio/1.1/vts/functional/Android.bp b/radio/1.1/vts/functional/Android.bp
index e7195ee..5695c6b 100644
--- a/radio/1.1/vts/functional/Android.bp
+++ b/radio/1.1/vts/functional/Android.bp
@@ -30,4 +30,5 @@
header_libs: [
"radio.util.header@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/radio/1.2/vts/functional/Android.bp b/radio/1.2/vts/functional/Android.bp
index a4e8c02..6782f14 100644
--- a/radio/1.2/vts/functional/Android.bp
+++ b/radio/1.2/vts/functional/Android.bp
@@ -31,4 +31,5 @@
"android.hardware.radio@1.0",
],
header_libs: ["radio.util.header@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/radio/1.4/Android.bp b/radio/1.4/Android.bp
index 02c6cad..a450f20 100644
--- a/radio/1.4/Android.bp
+++ b/radio/1.4/Android.bp
@@ -22,21 +22,21 @@
],
types: [
"AccessNetwork",
+ "CardStatus",
"CellConfigLte",
"CellInfo",
"CellInfoLte",
- "CardStatus",
"DataProfileInfo",
"DataRegStateResult",
"EmergencyNumber",
"EmergencyNumberSource",
"EmergencyServiceCategory",
"FrequencyRange",
- "RadioFrequencyInfo",
- "RadioTechnology",
- "PhysicalChannelConfig",
"LteVopsInfo",
"NetworkScanResult",
+ "PhysicalChannelConfig",
+ "RadioFrequencyInfo",
+ "RadioTechnology",
],
gen_java: true,
}
diff --git a/radio/config/1.0/vts/functional/Android.bp b/radio/config/1.0/vts/functional/Android.bp
index aa8266e..9c96030 100644
--- a/radio/config/1.0/vts/functional/Android.bp
+++ b/radio/config/1.0/vts/functional/Android.bp
@@ -29,4 +29,5 @@
"android.hardware.radio.config@1.0",
],
header_libs: ["radio.util.header@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/radio/config/1.1/Android.bp b/radio/config/1.1/Android.bp
index 62ebd44..056510c 100644
--- a/radio/config/1.1/Android.bp
+++ b/radio/config/1.1/Android.bp
@@ -13,8 +13,8 @@
"types.hal",
],
interfaces: [
- "android.hardware.radio@1.0",
"android.hardware.radio.config@1.0",
+ "android.hardware.radio@1.0",
"android.hidl.base@1.0",
],
types: [
@@ -23,3 +23,4 @@
],
gen_java: true,
}
+
diff --git a/radio/config/1.2/Android.bp b/radio/config/1.2/Android.bp
index c1eeb35..3e6a425 100644
--- a/radio/config/1.2/Android.bp
+++ b/radio/config/1.2/Android.bp
@@ -12,9 +12,9 @@
"IRadioConfigResponse.hal",
],
interfaces: [
- "android.hardware.radio@1.0",
"android.hardware.radio.config@1.0",
"android.hardware.radio.config@1.1",
+ "android.hardware.radio@1.0",
"android.hidl.base@1.0",
],
types: [
@@ -22,3 +22,4 @@
],
gen_java: true,
}
+
diff --git a/renderscript/1.0/vts/functional/Android.bp b/renderscript/1.0/vts/functional/Android.bp
index bf011e6..87e62f1 100644
--- a/renderscript/1.0/vts/functional/Android.bp
+++ b/renderscript/1.0/vts/functional/Android.bp
@@ -28,4 +28,5 @@
"android.hardware.renderscript@1.0",
"libnativewindow",
],
+ test_suites: ["general-tests"],
}
diff --git a/secure_element/1.0/vts/functional/Android.bp b/secure_element/1.0/vts/functional/Android.bp
index 752df9e..2b2b73e 100644
--- a/secure_element/1.0/vts/functional/Android.bp
+++ b/secure_element/1.0/vts/functional/Android.bp
@@ -21,4 +21,5 @@
static_libs: [
"android.hardware.secure_element@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/sensors/1.0/vts/functional/Android.bp b/sensors/1.0/vts/functional/Android.bp
index 6563e3c..d4c5f32 100644
--- a/sensors/1.0/vts/functional/Android.bp
+++ b/sensors/1.0/vts/functional/Android.bp
@@ -27,5 +27,6 @@
"android.hardware.sensors@1.0",
"VtsHalSensorsTargetTestUtils",
],
+ test_suites: ["general-tests"],
}
diff --git a/soundtrigger/2.0/vts/functional/Android.bp b/soundtrigger/2.0/vts/functional/Android.bp
index be6b3a8..f6207c4 100644
--- a/soundtrigger/2.0/vts/functional/Android.bp
+++ b/soundtrigger/2.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalSoundtriggerV2_0TargetTest.cpp"],
static_libs: ["android.hardware.soundtrigger@2.0"],
+ test_suites: ["general-tests"],
}
diff --git a/soundtrigger/2.1/vts/functional/Android.bp b/soundtrigger/2.1/vts/functional/Android.bp
index 925a17c..f1eb35d 100644
--- a/soundtrigger/2.1/vts/functional/Android.bp
+++ b/soundtrigger/2.1/vts/functional/Android.bp
@@ -25,4 +25,5 @@
"android.hardware.soundtrigger@2.1",
"libhidlmemory"
],
+ test_suites: ["general-tests"],
}
diff --git a/tests/msgq/1.0/default/Android.bp b/tests/msgq/1.0/default/Android.bp
index 6bbca24..6c8be6c 100644
--- a/tests/msgq/1.0/default/Android.bp
+++ b/tests/msgq/1.0/default/Android.bp
@@ -54,6 +54,7 @@
"libutils",
"android.hardware.tests.msgq@1.0"
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -80,4 +81,5 @@
// libs should be used on device.
static_libs: ["android.hardware.tests.msgq@1.0"],
whole_static_libs: ["android.hardware.tests.msgq@1.0-impl"],
+ test_suites: ["general-tests"],
}
diff --git a/tetheroffload/config/1.0/vts/functional/Android.bp b/tetheroffload/config/1.0/vts/functional/Android.bp
index dc95eaa..52b9810 100644
--- a/tetheroffload/config/1.0/vts/functional/Android.bp
+++ b/tetheroffload/config/1.0/vts/functional/Android.bp
@@ -17,4 +17,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalTetheroffloadConfigV1_0TargetTest.cpp"],
static_libs: ["android.hardware.tetheroffload.config@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/tetheroffload/control/1.0/vts/functional/Android.bp b/tetheroffload/control/1.0/vts/functional/Android.bp
index c6216a2..e8e1414 100644
--- a/tetheroffload/control/1.0/vts/functional/Android.bp
+++ b/tetheroffload/control/1.0/vts/functional/Android.bp
@@ -20,4 +20,5 @@
"android.hardware.tetheroffload.config@1.0",
"android.hardware.tetheroffload.control@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/thermal/1.0/vts/functional/Android.bp b/thermal/1.0/vts/functional/Android.bp
index f661f1e..6bda558 100644
--- a/thermal/1.0/vts/functional/Android.bp
+++ b/thermal/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalThermalV1_0TargetTest.cpp"],
static_libs: ["android.hardware.thermal@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/thermal/1.1/vts/functional/Android.bp b/thermal/1.1/vts/functional/Android.bp
index f5f01fa..9a16c30 100644
--- a/thermal/1.1/vts/functional/Android.bp
+++ b/thermal/1.1/vts/functional/Android.bp
@@ -22,5 +22,6 @@
"android.hardware.thermal@1.0",
"android.hardware.thermal@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/tv/input/1.0/vts/functional/Android.bp b/tv/input/1.0/vts/functional/Android.bp
index 978830c..29181b0 100644
--- a/tv/input/1.0/vts/functional/Android.bp
+++ b/tv/input/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalTvInputV1_0TargetTest.cpp"],
static_libs: ["android.hardware.tv.input@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/usb/1.0/vts/functional/Android.bp b/usb/1.0/vts/functional/Android.bp
index 96d3c0e..683ee17 100644
--- a/usb/1.0/vts/functional/Android.bp
+++ b/usb/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalUsbV1_0TargetTest.cpp"],
static_libs: ["android.hardware.usb@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/usb/1.1/vts/functional/Android.bp b/usb/1.1/vts/functional/Android.bp
index 4bb3203..1f0972f 100644
--- a/usb/1.1/vts/functional/Android.bp
+++ b/usb/1.1/vts/functional/Android.bp
@@ -22,5 +22,6 @@
"android.hardware.usb@1.0",
"android.hardware.usb@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/vibrator/1.0/vts/functional/Android.bp b/vibrator/1.0/vts/functional/Android.bp
index 016d627..391d3d4 100644
--- a/vibrator/1.0/vts/functional/Android.bp
+++ b/vibrator/1.0/vts/functional/Android.bp
@@ -19,5 +19,6 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalVibratorV1_0TargetTest.cpp"],
static_libs: ["android.hardware.vibrator@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/vibrator/1.1/vts/functional/Android.bp b/vibrator/1.1/vts/functional/Android.bp
index 4f6454b..c65ff41 100644
--- a/vibrator/1.1/vts/functional/Android.bp
+++ b/vibrator/1.1/vts/functional/Android.bp
@@ -22,5 +22,6 @@
"android.hardware.vibrator@1.0",
"android.hardware.vibrator@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/vibrator/1.2/vts/functional/Android.bp b/vibrator/1.2/vts/functional/Android.bp
index 3a4e2ef..1e3ec97 100644
--- a/vibrator/1.2/vts/functional/Android.bp
+++ b/vibrator/1.2/vts/functional/Android.bp
@@ -23,5 +23,6 @@
"android.hardware.vibrator@1.1",
"android.hardware.vibrator@1.2",
],
+ test_suites: ["general-tests"],
}
diff --git a/vr/1.0/vts/functional/Android.bp b/vr/1.0/vts/functional/Android.bp
index 4029137..958cce7 100644
--- a/vr/1.0/vts/functional/Android.bp
+++ b/vr/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalVrV1_0TargetTest.cpp"],
static_libs: ["android.hardware.vr@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/weaver/1.0/vts/functional/Android.bp b/weaver/1.0/vts/functional/Android.bp
index 0089d89..9fdbb18 100644
--- a/weaver/1.0/vts/functional/Android.bp
+++ b/weaver/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalWeaverV1_0TargetTest.cpp"],
static_libs: ["android.hardware.weaver@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index d0dd915..3189db4 100644
--- a/wifi/1.0/vts/functional/Android.bp
+++ b/wifi/1.0/vts/functional/Android.bp
@@ -48,6 +48,7 @@
"android.hardware.wifi@1.2",
"android.hardware.wifi@1.3",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -61,4 +62,5 @@
"VtsHalWifiV1_0TargetTestUtil",
"android.hardware.wifi@1.0",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/1.1/vts/functional/Android.bp b/wifi/1.1/vts/functional/Android.bp
index 1b0c12d..78d7a85 100644
--- a/wifi/1.1/vts/functional/Android.bp
+++ b/wifi/1.1/vts/functional/Android.bp
@@ -25,4 +25,5 @@
"android.hardware.wifi@1.0",
"android.hardware.wifi@1.1",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/1.2/vts/functional/Android.bp b/wifi/1.2/vts/functional/Android.bp
index c5a6e84..a969f65 100644
--- a/wifi/1.2/vts/functional/Android.bp
+++ b/wifi/1.2/vts/functional/Android.bp
@@ -28,6 +28,7 @@
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
],
+ test_suites: ["general-tests"],
}
cc_test {
@@ -43,4 +44,5 @@
"android.hardware.wifi@1.1",
"android.hardware.wifi@1.2",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/hostapd/1.0/vts/functional/Android.bp b/wifi/hostapd/1.0/vts/functional/Android.bp
index 7a920b4..79c5183 100644
--- a/wifi/hostapd/1.0/vts/functional/Android.bp
+++ b/wifi/hostapd/1.0/vts/functional/Android.bp
@@ -49,4 +49,5 @@
"libwifi-system",
"libwifi-system-iface",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/offload/1.0/vts/functional/Android.bp b/wifi/offload/1.0/vts/functional/Android.bp
index 140e45e..de15aa7 100644
--- a/wifi/offload/1.0/vts/functional/Android.bp
+++ b/wifi/offload/1.0/vts/functional/Android.bp
@@ -19,4 +19,5 @@
defaults: ["VtsHalTargetTestDefaults"],
srcs: ["VtsHalWifiOffloadV1_0TargetTest.cpp"],
static_libs: ["android.hardware.wifi.offload@1.0"],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/supplicant/1.0/vts/functional/Android.bp b/wifi/supplicant/1.0/vts/functional/Android.bp
index 7a6857c..bdccac1 100644
--- a/wifi/supplicant/1.0/vts/functional/Android.bp
+++ b/wifi/supplicant/1.0/vts/functional/Android.bp
@@ -53,6 +53,7 @@
"libwifi-system",
"libwifi-system-iface",
],
+ test_suites: ["general-tests"],
}
cc_test {
diff --git a/wifi/supplicant/1.1/vts/functional/Android.bp b/wifi/supplicant/1.1/vts/functional/Android.bp
index 3e65453..353ae4b 100644
--- a/wifi/supplicant/1.1/vts/functional/Android.bp
+++ b/wifi/supplicant/1.1/vts/functional/Android.bp
@@ -56,4 +56,5 @@
"libwifi-system",
"libwifi-system-iface",
],
+ test_suites: ["general-tests"],
}
diff --git a/wifi/supplicant/1.2/Android.bp b/wifi/supplicant/1.2/Android.bp
index 93ce573..529dad4 100644
--- a/wifi/supplicant/1.2/Android.bp
+++ b/wifi/supplicant/1.2/Android.bp
@@ -8,6 +8,7 @@
},
srcs: [
"ISupplicant.hal",
+ "ISupplicantP2pIface.hal",
"ISupplicantStaIface.hal",
"ISupplicantStaNetwork.hal",
],
diff --git a/wifi/supplicant/1.2/ISupplicantP2pIface.hal b/wifi/supplicant/1.2/ISupplicantP2pIface.hal
new file mode 100644
index 0000000..7f6970f
--- /dev/null
+++ b/wifi/supplicant/1.2/ISupplicantP2pIface.hal
@@ -0,0 +1,71 @@
+/*
+ * Copyright 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.
+ */
+
+package android.hardware.wifi.supplicant@1.2;
+
+import @1.0::ISupplicantP2pIface;
+import @1.0::MacAddress;
+import @1.0::Ssid;
+import @1.0::SupplicantStatus;
+
+/**
+ * Interface exposed by the supplicant for each P2P mode network
+ * interface (e.g p2p0) it controls.
+ * To use 1.2 features you must cast specific interfaces returned from the
+ * 1.2 HAL. For example V1_2::ISupplicant::addIface() adds V1_2::ISupplicantIface,
+ * which can be cast to V1_2::ISupplicantP2pIface.
+ */
+interface ISupplicantP2pIface extends @1.0::ISupplicantP2pIface {
+ /**
+ * Set up a P2P group owner or join a group as a group client
+ * with the specified configuration.
+ *
+ * If joinExistingGroup is false, this device sets up a P2P group owner manually (i.e.,
+ * without group owner negotiation with a specific peer) with the specified SSID,
+ * passphrase, persistent mode, and frequency/band.
+ *
+ * If joinExistingGroup is true, this device acts as a group client and joins the group
+ * whose network name and group owner's MAC address matches the specified SSID
+ * and peer address without WPS process. If peerAddress is 00:00:00:00:00:00, the first found
+ * group whose network name matches the specified SSID is joined.
+ *
+ * @param ssid The SSID of this group.
+ * @param pskPassphrase The passphrase of this group.
+ * @param persistent Used to request a persistent group to be formed,
+ * only applied for the group owner.
+ * @param freq The required frequency or band for this group.
+ * only applied for the group owner.
+ * The following values are supported:
+ * 0: automatic channel selection,
+ * 2: for 2.4GHz channels
+ * 5: for 5GHz channels
+ * specific frequency, i.e., 2412, 5500, etc.
+ * If an invalid band or unsupported frequency are specified, it fails.
+ * @param peerAddress the group owner's MAC address, only applied for the group client.
+ * If the MAC is "00:00:00:00:00:00", the device must try to find a peer
+ * whose network name matches the specified SSID.
+ * @param joinExistingGroup if true, join a group as a group client; otherwise,
+ * create a group as a group owner.
+ * @return status Status of the operation.
+ * Possible status codes:
+ * |SupplicantStatusCode.SUCCESS|,
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|,
+ * |SupplicantStatusCode.FAILURE_IFACE_INVALID|
+ */
+ addGroup_1_2(Ssid ssid, string pskPassphrase, bool persistent,
+ uint32_t freq, MacAddress peerAddress, bool joinExistingGroup)
+ generates (SupplicantStatus status);
+};