diff --git a/audio/common/all-versions/util/Android.bp b/audio/common/all-versions/util/Android.bp new file mode 100644 index 0000000000..5d33a3a189 --- /dev/null +++ b/audio/common/all-versions/util/Android.bp @@ -0,0 +1,10 @@ +cc_library_headers { + 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 new file mode 100644 index 0000000000..2d5481625c --- /dev/null +++ b/audio/common/all-versions/util/include/common/all-versions/IncludeGuard.h @@ -0,0 +1,19 @@ +/* + * 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/device/2.0/default/Android.bp b/audio/device/2.0/default/Android.bp new file mode 100644 index 0000000000..d0c466b597 --- /dev/null +++ b/audio/device/2.0/default/Android.bp @@ -0,0 +1,49 @@ +cc_library_shared { + name: "android.hardware.audio@2.0-impl", + relative_install_path: "hw", + proprietary: true, + vendor: true, + srcs: [ + "Conversions.cpp", + "Device.cpp", + "DevicesFactory.cpp", + "ParametersUtil.cpp", + "PrimaryDevice.cpp", + "Stream.cpp", + "StreamIn.cpp", + "StreamOut.cpp", + ], + + defaults: ["hidl_defaults"], + + 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@all-versions-impl", + "libaudioclient_headers", + "libaudio_system_headers", + "libhardware_headers", + "libmedia_headers", + ], + + whole_static_libs: [ + "libmedia_helper", + ], + +} diff --git a/audio/device/2.0/default/Conversions.cpp b/audio/device/2.0/default/Conversions.cpp new file mode 100644 index 0000000000..db5d8d07de --- /dev/null +++ b/audio/device/2.0/default/Conversions.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "device/2.0/default/Conversions.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION diff --git a/audio/device/2.0/default/Device.cpp b/audio/device/2.0/default/Device.cpp new file mode 100644 index 0000000000..d5bbae89f3 --- /dev/null +++ b/audio/device/2.0/default/Device.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "DeviceHAL" + +#include "device/2.0/default/Device.h" +#include +#include "device/2.0/default/Conversions.h" +#include "device/2.0/default/StreamIn.h" +#include "device/2.0/default/StreamOut.h" +#include "device/all-versions/default/Util.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION diff --git a/audio/device/2.0/default/DevicesFactory.cpp b/audio/device/2.0/default/DevicesFactory.cpp new file mode 100644 index 0000000000..4732404208 --- /dev/null +++ b/audio/device/2.0/default/DevicesFactory.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "DevicesFactoryHAL" + +#include "device/2.0/default/DevicesFactory.h" +#include "device/2.0/default/Device.h" +#include "device/2.0/default/PrimaryDevice.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION diff --git a/audio/device/2.0/default/OWNERS b/audio/device/2.0/default/OWNERS new file mode 100644 index 0000000000..6fdc97ca29 --- /dev/null +++ b/audio/device/2.0/default/OWNERS @@ -0,0 +1,3 @@ +elaurent@google.com +krocard@google.com +mnaganov@google.com diff --git a/audio/device/2.0/default/ParametersUtil.cpp b/audio/device/2.0/default/ParametersUtil.cpp new file mode 100644 index 0000000000..8fabf5f475 --- /dev/null +++ b/audio/device/2.0/default/ParametersUtil.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "device/2.0/default/ParametersUtil.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION diff --git a/audio/device/2.0/default/PrimaryDevice.cpp b/audio/device/2.0/default/PrimaryDevice.cpp new file mode 100644 index 0000000000..1f6e7b544e --- /dev/null +++ b/audio/device/2.0/default/PrimaryDevice.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "PrimaryDeviceHAL" + +#include "device/2.0/default/PrimaryDevice.h" +#include "device/all-versions/default/Util.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION diff --git a/audio/device/2.0/default/Stream.cpp b/audio/device/2.0/default/Stream.cpp new file mode 100644 index 0000000000..bdc6146b50 --- /dev/null +++ b/audio/device/2.0/default/Stream.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "StreamHAL" + +#include "device/2.0/default/Stream.h" +#include "common/all-versions/default/EffectMap.h" +#include "device/2.0/default/Conversions.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION diff --git a/audio/device/2.0/default/StreamIn.cpp b/audio/device/2.0/default/StreamIn.cpp new file mode 100644 index 0000000000..f97f6b3284 --- /dev/null +++ b/audio/device/2.0/default/StreamIn.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "StreamInHAL" + +#include "device/2.0/default/StreamIn.h" +#include "device/all-versions/default/Util.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION diff --git a/audio/device/2.0/default/StreamOut.cpp b/audio/device/2.0/default/StreamOut.cpp new file mode 100644 index 0000000000..152c4d2035 --- /dev/null +++ b/audio/device/2.0/default/StreamOut.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "StreamOutHAL" + +#include "device/2.0/default/StreamOut.h" +#include "device/all-versions/default/Util.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION diff --git a/audio/device/2.0/default/include/device/2.0/default/Conversions.h b/audio/device/2.0/default/include/device/2.0/default/Conversions.h new file mode 100644 index 0000000000..4579361709 --- /dev/null +++ b/audio/device/2.0/default/include/device/2.0/default/Conversions.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_ +#define ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_ + +#include + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION + +#endif // ANDROID_HARDWARE_AUDIO_V2_0_CONVERSIONS_H_ diff --git a/audio/device/2.0/default/include/device/2.0/default/Device.h b/audio/device/2.0/default/include/device/2.0/default/Device.h new file mode 100644 index 0000000000..d28f6ba22c --- /dev/null +++ b/audio/device/2.0/default/include/device/2.0/default/Device.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H +#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H + +#include + +#include "ParametersUtil.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION + +#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H diff --git a/audio/device/2.0/default/include/device/2.0/default/DevicesFactory.h b/audio/device/2.0/default/include/device/2.0/default/DevicesFactory.h new file mode 100644 index 0000000000..919154ae17 --- /dev/null +++ b/audio/device/2.0/default/include/device/2.0/default/DevicesFactory.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H +#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H + +#include + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION + +#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H diff --git a/audio/device/2.0/default/include/device/2.0/default/ParametersUtil.h b/audio/device/2.0/default/include/device/2.0/default/ParametersUtil.h new file mode 100644 index 0000000000..7d4c46f08f --- /dev/null +++ b/audio/device/2.0/default/include/device/2.0/default/ParametersUtil.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_ +#define ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_ + +#include + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION + +#endif // ANDROID_HARDWARE_AUDIO_V2_0_PARAMETERS_UTIL_H_ diff --git a/audio/device/2.0/default/include/device/2.0/default/PrimaryDevice.h b/audio/device/2.0/default/include/device/2.0/default/PrimaryDevice.h new file mode 100644 index 0000000000..e1fb4fe6c6 --- /dev/null +++ b/audio/device/2.0/default/include/device/2.0/default/PrimaryDevice.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H +#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H + +#include + +#include "Device.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION + +#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H diff --git a/audio/device/2.0/default/include/device/2.0/default/Stream.h b/audio/device/2.0/default/include/device/2.0/default/Stream.h new file mode 100644 index 0000000000..d059117536 --- /dev/null +++ b/audio/device/2.0/default/include/device/2.0/default/Stream.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H +#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H + +#include + +#include "ParametersUtil.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION + +#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H diff --git a/audio/device/2.0/default/include/device/2.0/default/StreamIn.h b/audio/device/2.0/default/include/device/2.0/default/StreamIn.h new file mode 100644 index 0000000000..28481f951d --- /dev/null +++ b/audio/device/2.0/default/include/device/2.0/default/StreamIn.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H +#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H + +#include + +#include "Device.h" +#include "Stream.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION + +#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H diff --git a/audio/device/2.0/default/include/device/2.0/default/StreamOut.h b/audio/device/2.0/default/include/device/2.0/default/StreamOut.h new file mode 100644 index 0000000000..7ab717857e --- /dev/null +++ b/audio/device/2.0/default/include/device/2.0/default/StreamOut.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H +#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H + +#include + +#include "Device.h" +#include "Stream.h" + +#define AUDIO_HAL_VERSION V2_0 +#include +#undef AUDIO_HAL_VERSION + +#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H diff --git a/audio/device/all-versions/default/Android.bp b/audio/device/all-versions/default/Android.bp index 4ad1aad223..3029359566 100644 --- a/audio/device/all-versions/default/Android.bp +++ b/audio/device/all-versions/default/Android.bp @@ -1,21 +1,13 @@ -cc_library_shared { - name: "android.hardware.audio@2.0-impl", +cc_library_headers { + name: "android.hardware.audio@all-versions-impl", relative_install_path: "hw", proprietary: true, vendor: true, - srcs: [ - "Conversions.cpp", - "Device.cpp", - "DevicesFactory.cpp", - "ParametersUtil.cpp", - "PrimaryDevice.cpp", - "Stream.cpp", - "StreamIn.cpp", - "StreamOut.cpp", - ], defaults: ["hidl_defaults"], + export_include_dirs: ["include"], + shared_libs: [ "libbase", "libcutils", @@ -25,9 +17,6 @@ cc_library_shared { "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", ], @@ -36,10 +25,6 @@ cc_library_shared { "libaudio_system_headers", "libhardware_headers", "libmedia_headers", + "android.hardware.audio.common.util@all-versions", ], - - whole_static_libs: [ - "libmedia_helper", - ], - } diff --git a/audio/device/all-versions/default/Conversions.h b/audio/device/all-versions/default/include/device/all-versions/default/Conversions.h similarity index 75% rename from audio/device/all-versions/default/Conversions.h rename to audio/device/all-versions/default/include/device/all-versions/default/Conversions.h index ebda5c572c..fa053509fc 100644 --- a/audio/device/all-versions/default/Conversions.h +++ b/audio/device/all-versions/default/include/device/all-versions/default/Conversions.h @@ -14,28 +14,24 @@ * limitations under the License. */ -#ifndef android_hardware_audio_V2_0_Conversions_H_ -#define android_hardware_audio_V2_0_Conversions_H_ +#include #include -#include #include namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::V2_0::DeviceAddress; +using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; std::string deviceAddressToHal(const DeviceAddress& address); } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android - -#endif // android_hardware_audio_V2_0_Conversions_H_ diff --git a/audio/device/all-versions/default/Conversions.cpp b/audio/device/all-versions/default/include/device/all-versions/default/Conversions.impl.h similarity index 96% rename from audio/device/all-versions/default/Conversions.cpp rename to audio/device/all-versions/default/include/device/all-versions/default/Conversions.impl.h index edd49c5c30..3f3f936a4a 100644 --- a/audio/device/all-versions/default/Conversions.cpp +++ b/audio/device/all-versions/default/include/device/all-versions/default/Conversions.impl.h @@ -14,14 +14,14 @@ * limitations under the License. */ -#include +#include -#include "Conversions.h" +#include namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { std::string deviceAddressToHal(const DeviceAddress& address) { @@ -55,7 +55,7 @@ std::string deviceAddressToHal(const DeviceAddress& address) { } } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/device/all-versions/default/Device.h b/audio/device/all-versions/default/include/device/all-versions/default/Device.h similarity index 75% rename from audio/device/all-versions/default/Device.h rename to audio/device/all-versions/default/include/device/all-versions/default/Device.h index b62e696f16..224823c8aa 100644 --- a/audio/device/all-versions/default/Device.h +++ b/audio/device/all-versions/default/include/device/all-versions/default/Device.h @@ -14,41 +14,37 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H -#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H +#include #include #include #include -#include #include #include -#include "ParametersUtil.h" - namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::common::V2_0::AudioConfig; -using ::android::hardware::audio::common::V2_0::AudioHwSync; -using ::android::hardware::audio::common::V2_0::AudioInputFlag; -using ::android::hardware::audio::common::V2_0::AudioOutputFlag; -using ::android::hardware::audio::common::V2_0::AudioPatchHandle; -using ::android::hardware::audio::common::V2_0::AudioPort; -using ::android::hardware::audio::common::V2_0::AudioPortConfig; -using ::android::hardware::audio::common::V2_0::AudioSource; -using ::android::hardware::audio::V2_0::DeviceAddress; -using ::android::hardware::audio::V2_0::IDevice; -using ::android::hardware::audio::V2_0::IStreamIn; -using ::android::hardware::audio::V2_0::IStreamOut; -using ::android::hardware::audio::V2_0::ParameterValue; -using ::android::hardware::audio::V2_0::Result; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioHwSync; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPatchHandle; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; +using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut; +using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; +using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::hidl_vec; @@ -58,7 +54,7 @@ using ::android::sp; struct Device : public IDevice, public ParametersUtil { explicit Device(audio_hw_device_t* device); - // Methods from ::android::hardware::audio::V2_0::IDevice follow. + // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow. Return initCheck() override; Return setMasterVolume(float volume) override; Return getMasterVolume(getMasterVolume_cb _hidl_cb) override; @@ -107,9 +103,7 @@ struct Device : public IDevice, public ParametersUtil { }; } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICE_H diff --git a/audio/device/all-versions/default/Device.cpp b/audio/device/all-versions/default/include/device/all-versions/default/Device.impl.h similarity index 96% rename from audio/device/all-versions/default/Device.cpp rename to audio/device/all-versions/default/include/device/all-versions/default/Device.impl.h index dae07ab6b4..b2950825ba 100644 --- a/audio/device/all-versions/default/Device.cpp +++ b/audio/device/all-versions/default/include/device/all-versions/default/Device.impl.h @@ -14,7 +14,8 @@ * limitations under the License. */ -#define LOG_TAG "DeviceHAL" +#include + //#define LOG_NDEBUG 0 #include @@ -23,19 +24,13 @@ #include -#include "Conversions.h" -#include "Device.h" -#include "HidlUtils.h" -#include "StreamIn.h" -#include "StreamOut.h" -#include "Util.h" - -using ::android::hardware::audio::common::V2_0::HidlUtils; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::HidlUtils; +using ::android::hardware::audio::all_versions::implementation::isGainNormalized; namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { Device::Device(audio_hw_device_t* device) : mDevice(device) {} @@ -82,7 +77,7 @@ int Device::halSetParameters(const char* keysAndValues) { return mDevice->set_parameters(mDevice, keysAndValues); } -// Methods from ::android::hardware::audio::V2_0::IDevice follow. +// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow. Return Device::initCheck() { return analyzeStatus("init_check", mDevice->init_check(mDevice)); } @@ -288,7 +283,7 @@ Return Device::debugDump(const hidl_handle& fd) { } } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/device/all-versions/default/DevicesFactory.h b/audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.h similarity index 74% rename from audio/device/all-versions/default/DevicesFactory.h rename to audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.h index 39437c1027..769adaa1e9 100644 --- a/audio/device/all-versions/default/DevicesFactory.h +++ b/audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.h @@ -14,24 +14,22 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H -#define ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H +#include #include -#include #include #include namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::V2_0::IDevice; -using ::android::hardware::audio::V2_0::IDevicesFactory; -using ::android::hardware::audio::V2_0::Result; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory; +using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::hidl_vec; @@ -39,7 +37,7 @@ using ::android::hardware::hidl_string; using ::android::sp; struct DevicesFactory : public IDevicesFactory { - // Methods from ::android::hardware::audio::V2_0::IDevicesFactory follow. + // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory follow. Return openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) override; private: @@ -50,9 +48,7 @@ struct DevicesFactory : public IDevicesFactory { extern "C" IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* name); } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_DEVICESFACTORY_H diff --git a/audio/device/all-versions/default/DevicesFactory.cpp b/audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.impl.h similarity index 90% rename from audio/device/all-versions/default/DevicesFactory.cpp rename to audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.impl.h index 2625ac71ca..014b4d8043 100644 --- a/audio/device/all-versions/default/DevicesFactory.cpp +++ b/audio/device/all-versions/default/include/device/all-versions/default/DevicesFactory.impl.h @@ -14,20 +14,16 @@ * limitations under the License. */ -#define LOG_TAG "DevicesFactoryHAL" +#include #include #include -#include "Device.h" -#include "DevicesFactory.h" -#include "PrimaryDevice.h" - namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { // static @@ -77,7 +73,7 @@ out: return rc; } -// Methods from ::android::hardware::audio::V2_0::IDevicesFactory follow. +// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevicesFactory follow. Return DevicesFactory::openDevice(IDevicesFactory::Device device, openDevice_cb _hidl_cb) { audio_hw_device_t* halDevice; Result retval(Result::INVALID_ARGUMENTS); @@ -89,7 +85,8 @@ Return DevicesFactory::openDevice(IDevicesFactory::Device device, openDevi if (device == IDevicesFactory::Device::PRIMARY) { result = new PrimaryDevice(halDevice); } else { - result = new ::android::hardware::audio::V2_0::implementation::Device(halDevice); + result = new ::android::hardware::audio::AUDIO_HAL_VERSION::implementation::Device( + halDevice); } retval = Result::OK; } else if (halStatus == -EINVAL) { @@ -105,7 +102,7 @@ IDevicesFactory* HIDL_FETCH_IDevicesFactory(const char* /* name */) { } } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/device/all-versions/default/ParametersUtil.h b/audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.h similarity index 84% rename from audio/device/all-versions/default/ParametersUtil.h rename to audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.h index 671c9e3569..df5adeefc1 100644 --- a/audio/device/all-versions/default/ParametersUtil.h +++ b/audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.h @@ -14,24 +14,22 @@ * limitations under the License. */ -#ifndef android_hardware_audio_V2_0_ParametersUtil_H_ -#define android_hardware_audio_V2_0_ParametersUtil_H_ +#include #include #include -#include #include #include namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::V2_0::ParameterValue; -using ::android::hardware::audio::V2_0::Result; +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; @@ -58,9 +56,7 @@ class ParametersUtil { }; } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android - -#endif // android_hardware_audio_V2_0_ParametersUtil_H_ diff --git a/audio/device/all-versions/default/ParametersUtil.cpp b/audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.impl.h similarity index 98% rename from audio/device/all-versions/default/ParametersUtil.cpp rename to audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.impl.h index 75b672d324..a858a488eb 100644 --- a/audio/device/all-versions/default/ParametersUtil.cpp +++ b/audio/device/all-versions/default/include/device/all-versions/default/ParametersUtil.impl.h @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "ParametersUtil.h" +#include namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { /** Converts a status_t in Result according to the rules of AudioParameter::get* @@ -159,7 +159,7 @@ Result ParametersUtil::setParams(const AudioParameter& param) { } } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/device/all-versions/default/PrimaryDevice.h b/audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.h similarity index 75% rename from audio/device/all-versions/default/PrimaryDevice.h rename to audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.h index 6b5accc14e..240b2212a2 100644 --- a/audio/device/all-versions/default/PrimaryDevice.h +++ b/audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.h @@ -14,36 +14,32 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H -#define ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H +#include -#include #include #include -#include "Device.h" - namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::common::V2_0::AudioConfig; -using ::android::hardware::audio::common::V2_0::AudioInputFlag; -using ::android::hardware::audio::common::V2_0::AudioMode; -using ::android::hardware::audio::common::V2_0::AudioOutputFlag; -using ::android::hardware::audio::common::V2_0::AudioPort; -using ::android::hardware::audio::common::V2_0::AudioPortConfig; -using ::android::hardware::audio::common::V2_0::AudioSource; -using ::android::hardware::audio::V2_0::DeviceAddress; -using ::android::hardware::audio::V2_0::IDevice; -using ::android::hardware::audio::V2_0::IPrimaryDevice; -using ::android::hardware::audio::V2_0::IStreamIn; -using ::android::hardware::audio::V2_0::IStreamOut; -using ::android::hardware::audio::V2_0::ParameterValue; -using ::android::hardware::audio::V2_0::Result; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioConfig; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioInputFlag; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioMode; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioOutputFlag; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPort; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioPortConfig; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; +using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut; +using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; +using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::hidl_vec; @@ -53,7 +49,7 @@ using ::android::sp; struct PrimaryDevice : public IPrimaryDevice { explicit PrimaryDevice(audio_hw_device_t* device); - // Methods from ::android::hardware::audio::V2_0::IDevice follow. + // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow. Return initCheck() override; Return setMasterVolume(float volume) override; Return getMasterVolume(getMasterVolume_cb _hidl_cb) override; @@ -83,7 +79,7 @@ struct PrimaryDevice : public IPrimaryDevice { Return setParameters(const hidl_vec& parameters) override; Return debugDump(const hidl_handle& fd) override; - // Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow. + // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow. Return setVoiceVolume(float volume) override; Return setMode(AudioMode mode) override; Return getBtScoNrecEnabled(getBtScoNrecEnabled_cb _hidl_cb) override; @@ -102,9 +98,7 @@ struct PrimaryDevice : public IPrimaryDevice { }; } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_PRIMARYDEVICE_H diff --git a/audio/device/all-versions/default/PrimaryDevice.cpp b/audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.impl.h similarity index 95% rename from audio/device/all-versions/default/PrimaryDevice.cpp rename to audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.impl.h index 2c02a71d6f..3ce047ac07 100644 --- a/audio/device/all-versions/default/PrimaryDevice.cpp +++ b/audio/device/all-versions/default/include/device/all-versions/default/PrimaryDevice.impl.h @@ -14,22 +14,19 @@ * limitations under the License. */ -#define LOG_TAG "PrimaryDeviceHAL" - -#include "PrimaryDevice.h" -#include "Util.h" +#include namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { PrimaryDevice::PrimaryDevice(audio_hw_device_t* device) : mDevice(new Device(device)) {} PrimaryDevice::~PrimaryDevice() {} -// Methods from ::android::hardware::audio::V2_0::IDevice follow. +// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IDevice follow. Return PrimaryDevice::initCheck() { return mDevice->initCheck(); } @@ -118,9 +115,9 @@ Return PrimaryDevice::debugDump(const hidl_handle& fd) { return mDevice->debugDump(fd); } -// Methods from ::android::hardware::audio::V2_0::IPrimaryDevice follow. +// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IPrimaryDevice follow. Return PrimaryDevice::setVoiceVolume(float volume) { - if (!isGainNormalized(volume)) { + if (!all_versions::implementation::isGainNormalized(volume)) { ALOGW("Can not set a voice volume (%f) outside [0,1]", volume); return Result::INVALID_ARGUMENTS; } @@ -192,7 +189,7 @@ Return PrimaryDevice::setHacEnabled(bool enabled) { } } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/device/all-versions/default/Stream.h b/audio/device/all-versions/default/include/device/all-versions/default/Stream.h similarity index 89% rename from audio/device/all-versions/default/Stream.h rename to audio/device/all-versions/default/include/device/all-versions/default/Stream.h index 17e5c396d0..4196dec7df 100644 --- a/audio/device/all-versions/default/Stream.h +++ b/audio/device/all-versions/default/include/device/all-versions/default/Stream.h @@ -14,32 +14,28 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H -#define ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H +#include #include -#include #include #include #include -#include "ParametersUtil.h" - namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::common::V2_0::AudioChannelMask; -using ::android::hardware::audio::common::V2_0::AudioDevice; -using ::android::hardware::audio::common::V2_0::AudioFormat; -using ::android::hardware::audio::V2_0::DeviceAddress; -using ::android::hardware::audio::V2_0::IStream; -using ::android::hardware::audio::V2_0::ParameterValue; -using ::android::hardware::audio::V2_0::Result; +using ::android::hardware::audio::common::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::DeviceAddress; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream; +using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; +using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::hidl_vec; @@ -56,7 +52,7 @@ struct Stream : public IStream, public ParametersUtil { */ static constexpr uint32_t MAX_BUFFER_SIZE = 2 << 30 /* == 1GiB */; - // Methods from ::android::hardware::audio::V2_0::IStream follow. + // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. Return getFrameSize() override; Return getFrameCount() override; Return getBufferSize() override; @@ -178,9 +174,7 @@ Return StreamMmap::getMmapPosition(IStream::getMmapPosition_cb _hidl_cb } } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAM_H diff --git a/audio/device/all-versions/default/Stream.cpp b/audio/device/all-versions/default/include/device/all-versions/default/Stream.impl.h similarity index 97% rename from audio/device/all-versions/default/Stream.cpp rename to audio/device/all-versions/default/include/device/all-versions/default/Stream.impl.h index 08331239dd..92cff72642 100644 --- a/audio/device/all-versions/default/Stream.cpp +++ b/audio/device/all-versions/default/include/device/all-versions/default/Stream.impl.h @@ -14,9 +14,9 @@ * limitations under the License. */ -#include +#include -#define LOG_TAG "StreamHAL" +#include #include #include @@ -25,14 +25,10 @@ #include #include -#include "Conversions.h" -#include "Stream.h" -#include "common/all-versions/default/EffectMap.h" - namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { Stream::Stream(audio_stream_t* stream) : mStream(stream) {} @@ -82,7 +78,7 @@ int Stream::halSetParameters(const char* keysAndValues) { return mStream->set_parameters(mStream, keysAndValues); } -// Methods from ::android::hardware::audio::V2_0::IStream follow. +// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. Return 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. @@ -274,7 +270,7 @@ Return Stream::close() { } } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/device/all-versions/default/StreamIn.h b/audio/device/all-versions/default/include/device/all-versions/default/StreamIn.h similarity index 82% rename from audio/device/all-versions/default/StreamIn.h rename to audio/device/all-versions/default/include/device/all-versions/default/StreamIn.h index dfb806a556..7380dae108 100644 --- a/audio/device/all-versions/default/StreamIn.h +++ b/audio/device/all-versions/default/include/device/all-versions/default/StreamIn.h @@ -14,37 +14,32 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H -#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H +#include #include #include -#include #include #include #include #include #include -#include "Device.h" -#include "Stream.h" - namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::common::V2_0::AudioChannelMask; -using ::android::hardware::audio::common::V2_0::AudioDevice; -using ::android::hardware::audio::common::V2_0::AudioFormat; -using ::android::hardware::audio::common::V2_0::AudioSource; -using ::android::hardware::audio::V2_0::DeviceAddress; -using ::android::hardware::audio::V2_0::IStream; -using ::android::hardware::audio::V2_0::IStreamIn; -using ::android::hardware::audio::V2_0::ParameterValue; -using ::android::hardware::audio::V2_0::Result; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioSource; +using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn; +using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; +using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::hidl_vec; @@ -58,7 +53,7 @@ struct StreamIn : public IStreamIn { StreamIn(const sp& device, audio_stream_in_t* stream); - // Methods from ::android::hardware::audio::V2_0::IStream follow. + // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. Return getFrameSize() override; Return getFrameCount() override; Return getBufferSize() override; @@ -85,7 +80,7 @@ struct StreamIn : public IStreamIn { Return debugDump(const hidl_handle& fd) override; Return close() override; - // Methods from ::android::hardware::audio::V2_0::IStreamIn follow. + // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow. Return getAudioSource(getAudioSource_cb _hidl_cb) override; Return setGain(float gain) override; Return prepareForReading(uint32_t frameSize, uint32_t framesCount, @@ -117,9 +112,7 @@ struct StreamIn : public IStreamIn { }; } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H diff --git a/audio/device/all-versions/default/StreamIn.cpp b/audio/device/all-versions/default/include/device/all-versions/default/StreamIn.impl.h similarity index 96% rename from audio/device/all-versions/default/StreamIn.cpp rename to audio/device/all-versions/default/include/device/all-versions/default/StreamIn.impl.h index 7c87202130..abee225dc7 100644 --- a/audio/device/all-versions/default/StreamIn.cpp +++ b/audio/device/all-versions/default/include/device/all-versions/default/StreamIn.impl.h @@ -14,7 +14,8 @@ * limitations under the License. */ -#define LOG_TAG "StreamInHAL" +#include + //#define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_AUDIO @@ -23,18 +24,16 @@ #include #include -#include "StreamIn.h" -#include "Util.h" - -using ::android::hardware::audio::V2_0::MessageQueueFlagBits; +using ::android::hardware::audio::AUDIO_HAL_VERSION::MessageQueueFlagBits; +using ::android::hardware::audio::all_versions::implementation::isGainNormalized; namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::common::V2_0::ThreadInfo; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo; namespace { @@ -163,7 +162,7 @@ StreamIn::~StreamIn() { mStream = nullptr; } -// Methods from ::android::hardware::audio::V2_0::IStream follow. +// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. Return StreamIn::getFrameSize() { return audio_stream_in_frame_size(mStream); } @@ -285,7 +284,7 @@ Return StreamIn::close() { return Result::OK; } -// Methods from ::android::hardware::audio::V2_0::IStreamIn follow. +// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamIn follow. Return StreamIn::getAudioSource(getAudioSource_cb _hidl_cb) { int halSource; Result retval = mStreamCommon->getParam(AudioParameter::keyInputSource, &halSource); @@ -417,7 +416,7 @@ Return StreamIn::getCapturePosition(getCapturePosition_cb _hidl_cb) { } } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/device/all-versions/default/StreamOut.h b/audio/device/all-versions/default/include/device/all-versions/default/StreamOut.h similarity index 82% rename from audio/device/all-versions/default/StreamOut.h rename to audio/device/all-versions/default/include/device/all-versions/default/StreamOut.h index 35960c5b5a..4cfe2e33f1 100644 --- a/audio/device/all-versions/default/StreamOut.h +++ b/audio/device/all-versions/default/include/device/all-versions/default/StreamOut.h @@ -14,39 +14,34 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H -#define ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H +#include #include #include -#include #include #include #include #include #include -#include "Device.h" -#include "Stream.h" - namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::common::V2_0::AudioChannelMask; -using ::android::hardware::audio::common::V2_0::AudioDevice; -using ::android::hardware::audio::common::V2_0::AudioFormat; -using ::android::hardware::audio::V2_0::AudioDrain; -using ::android::hardware::audio::V2_0::DeviceAddress; -using ::android::hardware::audio::V2_0::IStream; -using ::android::hardware::audio::V2_0::IStreamOut; -using ::android::hardware::audio::V2_0::IStreamOutCallback; -using ::android::hardware::audio::V2_0::ParameterValue; -using ::android::hardware::audio::V2_0::Result; -using ::android::hardware::audio::V2_0::TimeSpec; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioChannelMask; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioDevice; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::AudioFormat; +using ::android::hardware::audio::AUDIO_HAL_VERSION::AudioDrain; +using ::android::hardware::audio::AUDIO_HAL_VERSION::DeviceAddress; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStream; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut; +using ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOutCallback; +using ::android::hardware::audio::AUDIO_HAL_VERSION::ParameterValue; +using ::android::hardware::audio::AUDIO_HAL_VERSION::Result; +using ::android::hardware::audio::AUDIO_HAL_VERSION::TimeSpec; using ::android::hardware::Return; using ::android::hardware::Void; using ::android::hardware::hidl_vec; @@ -60,7 +55,7 @@ struct StreamOut : public IStreamOut { StreamOut(const sp& device, audio_stream_out_t* stream); - // Methods from ::android::hardware::audio::V2_0::IStream follow. + // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. Return getFrameSize() override; Return getFrameCount() override; Return getBufferSize() override; @@ -87,7 +82,7 @@ struct StreamOut : public IStreamOut { Return debugDump(const hidl_handle& fd) override; Return close() override; - // Methods from ::android::hardware::audio::V2_0::IStreamOut follow. + // Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow. Return getLatency() override; Return setVolume(float left, float right) override; Return prepareForWriting(uint32_t frameSize, uint32_t framesCount, @@ -131,9 +126,7 @@ struct StreamOut : public IStreamOut { }; } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android - -#endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMOUT_H diff --git a/audio/device/all-versions/default/StreamOut.cpp b/audio/device/all-versions/default/include/device/all-versions/default/StreamOut.impl.h similarity index 97% rename from audio/device/all-versions/default/StreamOut.cpp rename to audio/device/all-versions/default/include/device/all-versions/default/StreamOut.impl.h index d811a40e80..bdbeb38288 100644 --- a/audio/device/all-versions/default/StreamOut.cpp +++ b/audio/device/all-versions/default/include/device/all-versions/default/StreamOut.impl.h @@ -14,7 +14,8 @@ * limitations under the License. */ -#define LOG_TAG "StreamOutHAL" +#include + //#define LOG_NDEBUG 0 #define ATRACE_TAG ATRACE_TAG_AUDIO @@ -24,16 +25,14 @@ #include #include -#include "StreamOut.h" -#include "Util.h" - namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace AUDIO_HAL_VERSION { namespace implementation { -using ::android::hardware::audio::common::V2_0::ThreadInfo; +using ::android::hardware::audio::common::AUDIO_HAL_VERSION::ThreadInfo; +using ::android::hardware::audio::all_versions::implementation::isGainNormalized; namespace { @@ -167,7 +166,7 @@ StreamOut::~StreamOut() { mStream = nullptr; } -// Methods from ::android::hardware::audio::V2_0::IStream follow. +// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStream follow. Return StreamOut::getFrameSize() { return audio_stream_out_frame_size(mStream); } @@ -273,7 +272,7 @@ Return StreamOut::close() { return Result::OK; } -// Methods from ::android::hardware::audio::V2_0::IStreamOut follow. +// Methods from ::android::hardware::audio::AUDIO_HAL_VERSION::IStreamOut follow. Return StreamOut::getLatency() { return mStream->get_latency(mStream); } @@ -514,7 +513,7 @@ Return StreamOut::getMmapPosition(getMmapPosition_cb _hidl_cb) { } } // namespace implementation -} // namespace V2_0 +} // namespace AUDIO_HAL_VERSION } // namespace audio } // namespace hardware } // namespace android diff --git a/audio/device/all-versions/default/Util.h b/audio/device/all-versions/default/include/device/all-versions/default/Util.h similarity index 80% rename from audio/device/all-versions/default/Util.h rename to audio/device/all-versions/default/include/device/all-versions/default/Util.h index 72eea5037b..39d9dbde00 100644 --- a/audio/device/all-versions/default/Util.h +++ b/audio/device/all-versions/default/include/device/all-versions/default/Util.h @@ -14,13 +14,13 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H -#define ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H +#ifndef ANDROID_HARDWARE_AUDIO_DEVICE_ALL_VERSIONS_UTIL_H +#define ANDROID_HARDWARE_AUDIO_DEVICE_ALL_VERSIONS_UTIL_H namespace android { namespace hardware { namespace audio { -namespace V2_0 { +namespace all_versions { namespace implementation { /** @return true if gain is between 0 and 1 included. */ @@ -29,9 +29,9 @@ constexpr bool isGainNormalized(float gain) { } } // namespace implementation -} // namespace V2_0 +} // namespace all_versions } // namespace audio } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_AUDIO_V2_0_UTIL_H +#endif // ANDROID_HARDWARE_AUDIO_DEVICE_ALL_VERSIONS_UTIL_H