Loading audio/aidl/Android.bp +16 −0 Original line number Diff line number Diff line Loading @@ -166,3 +166,19 @@ aidl_interface { }, }, } latest_android_hardware_audio_effect = "android.hardware.audio.effect-V1" cc_defaults { name: "latest_android_hardware_audio_effect_ndk_shared", shared_libs: [ latest_android_hardware_audio_effect + "-ndk", ], } cc_defaults { name: "latest_android_hardware_audio_effect_ndk_static", static_libs: [ latest_android_hardware_audio_effect + "-ndk", ], } audio/aidl/default/Android.bp +5 −1 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ cc_defaults { "libbase", "libbinder_ndk", "android.hardware.audio.effect-V1-ndk", "libequalizer", ], cflags: [ "-Wall", Loading @@ -80,7 +81,10 @@ cc_defaults { cc_library_static { name: "libaudioeffectserviceexampleimpl", defaults: ["aidlaudioeffectservice_defaults"], export_include_dirs: ["include"], export_include_dirs: [ "include", "include/equalizer-impl/", ], srcs: [ "EffectFactory.cpp", ], Loading audio/aidl/default/EffectFactory.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ Factory::Factory() { {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; id.uuid = EqualizerUUID; mIdentityList.push_back(id); // TODO: Add visualizer with default implementation later #if 0 id.type = {static_cast<int32_t>(0xd3467faa), 0xacc7, 0x4d34, Loading @@ -43,6 +45,7 @@ Factory::Factory() { {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; id.uuid = VisualizerUUID; mIdentityList.push_back(id); #endif } ndk::ScopedAStatus Factory::queryEffects(const std::optional<AudioUuid>& in_type, Loading @@ -56,4 +59,28 @@ ndk::ScopedAStatus Factory::queryEffects(const std::optional<AudioUuid>& in_type return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Factory::createEffect( const AudioUuid& in_impl_uuid, std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>* _aidl_return) { LOG(DEBUG) << __func__ << ": UUID " << in_impl_uuid.toString(); if (in_impl_uuid == EqualizerUUID) { *_aidl_return = ndk::SharedRefBase::make<Equalizer>(); } else { LOG(ERROR) << __func__ << ": UUID " << " not supported"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Factory::destroyEffect( const std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>& in_handle) { if (in_handle) { // TODO: b/245393900 need check the instance state with IEffect.getState before destroy. return ndk::ScopedAStatus::ok(); } else { return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } } } // namespace aidl::android::hardware::audio::effect audio/aidl/default/EffectMain.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -23,10 +23,11 @@ int main() { // This is a debug implementation, always enable debug logging. android::base::SetMinimumLogSeverity(::android::base::DEBUG); ABinderProcess_setThreadPoolMaxThreadCount(16); ABinderProcess_setThreadPoolMaxThreadCount(1); auto effectFactory = ndk::SharedRefBase::make<aidl::android::hardware::audio::effect::Factory>(); std::string serviceName = std::string() + effectFactory->descriptor + "/default"; binder_status_t status = AServiceManager_addService(effectFactory->asBinder().get(), serviceName.c_str()); Loading audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ service vendor.audio-effect-hal-aidl /vendor/bin/hw/android.hardware.audio.effec class hal user audioserver # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub group audio media capabilities BLOCK_SUSPEND ioprio rt 4 task_profiles ProcessCapacityHigh HighPerformance Loading Loading
audio/aidl/Android.bp +16 −0 Original line number Diff line number Diff line Loading @@ -166,3 +166,19 @@ aidl_interface { }, }, } latest_android_hardware_audio_effect = "android.hardware.audio.effect-V1" cc_defaults { name: "latest_android_hardware_audio_effect_ndk_shared", shared_libs: [ latest_android_hardware_audio_effect + "-ndk", ], } cc_defaults { name: "latest_android_hardware_audio_effect_ndk_static", static_libs: [ latest_android_hardware_audio_effect + "-ndk", ], }
audio/aidl/default/Android.bp +5 −1 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ cc_defaults { "libbase", "libbinder_ndk", "android.hardware.audio.effect-V1-ndk", "libequalizer", ], cflags: [ "-Wall", Loading @@ -80,7 +81,10 @@ cc_defaults { cc_library_static { name: "libaudioeffectserviceexampleimpl", defaults: ["aidlaudioeffectservice_defaults"], export_include_dirs: ["include"], export_include_dirs: [ "include", "include/equalizer-impl/", ], srcs: [ "EffectFactory.cpp", ], Loading
audio/aidl/default/EffectFactory.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ Factory::Factory() { {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; id.uuid = EqualizerUUID; mIdentityList.push_back(id); // TODO: Add visualizer with default implementation later #if 0 id.type = {static_cast<int32_t>(0xd3467faa), 0xacc7, 0x4d34, Loading @@ -43,6 +45,7 @@ Factory::Factory() { {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; id.uuid = VisualizerUUID; mIdentityList.push_back(id); #endif } ndk::ScopedAStatus Factory::queryEffects(const std::optional<AudioUuid>& in_type, Loading @@ -56,4 +59,28 @@ ndk::ScopedAStatus Factory::queryEffects(const std::optional<AudioUuid>& in_type return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Factory::createEffect( const AudioUuid& in_impl_uuid, std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>* _aidl_return) { LOG(DEBUG) << __func__ << ": UUID " << in_impl_uuid.toString(); if (in_impl_uuid == EqualizerUUID) { *_aidl_return = ndk::SharedRefBase::make<Equalizer>(); } else { LOG(ERROR) << __func__ << ": UUID " << " not supported"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Factory::destroyEffect( const std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>& in_handle) { if (in_handle) { // TODO: b/245393900 need check the instance state with IEffect.getState before destroy. return ndk::ScopedAStatus::ok(); } else { return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } } } // namespace aidl::android::hardware::audio::effect
audio/aidl/default/EffectMain.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -23,10 +23,11 @@ int main() { // This is a debug implementation, always enable debug logging. android::base::SetMinimumLogSeverity(::android::base::DEBUG); ABinderProcess_setThreadPoolMaxThreadCount(16); ABinderProcess_setThreadPoolMaxThreadCount(1); auto effectFactory = ndk::SharedRefBase::make<aidl::android::hardware::audio::effect::Factory>(); std::string serviceName = std::string() + effectFactory->descriptor + "/default"; binder_status_t status = AServiceManager_addService(effectFactory->asBinder().get(), serviceName.c_str()); Loading
audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ service vendor.audio-effect-hal-aidl /vendor/bin/hw/android.hardware.audio.effec class hal user audioserver # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub group audio media capabilities BLOCK_SUSPEND ioprio rt 4 task_profiles ProcessCapacityHigh HighPerformance Loading