diff --git a/universal7885-common/apps/aidl-support/audio_route/aidl_api/vendor.eureka.hardware.audio_route/1/.hash b/universal7885-common/apps/aidl-support/audio_route/aidl_api/vendor.eureka.hardware.audio_route/1/.hash index f3b625d..437b0fc 100644 --- a/universal7885-common/apps/aidl-support/audio_route/aidl_api/vendor.eureka.hardware.audio_route/1/.hash +++ b/universal7885-common/apps/aidl-support/audio_route/aidl_api/vendor.eureka.hardware.audio_route/1/.hash @@ -1 +1 @@ -e5802a2cbeff18d06e61d70381d5f1b65f2448ca +97491c5753e9408d4a75687169e7b791ec19a907 diff --git a/universal7885-common/apps/aidl-support/audio_route/default/AudioRoute.cpp b/universal7885-common/apps/aidl-support/audio_route/default/AudioRoute.cpp index 43fcde9..2b2c47f 100644 --- a/universal7885-common/apps/aidl-support/audio_route/default/AudioRoute.cpp +++ b/universal7885-common/apps/aidl-support/audio_route/default/AudioRoute.cpp @@ -23,10 +23,14 @@ using namespace android; -ndk::ScopedAStatus AudioRoute::setParam(std::string param) { +namespace aidl::vendor::eureka::hardware::audio_route { + +ndk::ScopedAStatus AudioRoute::setParam(const std::string& param) { const sp &af = AudioSystem::get_audio_flinger(); if (af == 0) return ndk::ScopedAStatus::fromExceptionCode(EX_SECURITY); af->setParameters(IOHANDLE, String8(param.c_str())); return ndk::ScopedAStatus::ok();; } + +} diff --git a/universal7885-common/apps/aidl-support/audio_route/default/AudioRoute.h b/universal7885-common/apps/aidl-support/audio_route/default/AudioRoute.h index c372b71..3425442 100644 --- a/universal7885-common/apps/aidl-support/audio_route/default/AudioRoute.h +++ b/universal7885-common/apps/aidl-support/audio_route/default/AudioRoute.h @@ -22,6 +22,6 @@ struct AudioRoute : public BnAudioRoute { public: AudioRoute() = default; // Methods from aidl::vendor::eureka::hardware::fmradio::IFMRadio follow. - ::ndk::ScopedAStatus setParam(std::string param) override; + ::ndk::ScopedAStatus setParam(const std::string& param) override; }; } // namespace aidl::vendor::eureka::hardware::fmradio diff --git a/universal7885-common/apps/aidl-support/audio_route/default/service.cpp b/universal7885-common/apps/aidl-support/audio_route/default/service.cpp index 88d5370..4f7b494 100644 --- a/universal7885-common/apps/aidl-support/audio_route/default/service.cpp +++ b/universal7885-common/apps/aidl-support/audio_route/default/service.cpp @@ -24,7 +24,7 @@ int main() { ABinderProcess_setThreadPoolMaxThreadCount(3); auto service = ndk::SharedRefBase::make(); - const std::string instance = std::string() + C::descriptor + "/default"; + const std::string instance = std::string() + AudioRoute::descriptor + "/default"; binder_status_t status = AServiceManager_addService(service->asBinder().get(), instance.c_str()); CHECK(status == STATUS_OK); diff --git a/universal7885-common/apps/aidl-support/fm/default/FMDevControl.cpp b/universal7885-common/apps/aidl-support/fm/default/FMDevControl.cpp index 1d0ec88..d84725f 100644 --- a/universal7885-common/apps/aidl-support/fm/default/FMDevControl.cpp +++ b/universal7885-common/apps/aidl-support/fm/default/FMDevControl.cpp @@ -16,10 +16,12 @@ #include +#include + #include #include -#include +#include namespace aidl::vendor::eureka::hardware::fmradio { @@ -64,6 +66,7 @@ static int fd = -1; ::ndk::ScopedAStatus FMDevControl::setValue(SetType type, int value) { assert(fd > 0); + std::shared_ptr svc; switch (type) { case SetType::SET_TYPE_FM_FREQ: fm_radio_slsi::set_frequency(fd, value); @@ -84,7 +87,7 @@ static int fd = -1; fm_radio_slsi::stop_search(fd); break; case SetType::SET_TYPE_FM_SPEAKER_ROUTE: - auto svc = IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default"))); + svc = audio_route::IAudioRoute::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService("vendor.eureka.hardware.audio_route.IAudioRoute/default"))); svc->setParam(value ? "routing=2": "routing=8"); break; default: diff --git a/universal7885-common/sepolicy/private/hal_audio_route_default.te b/universal7885-common/sepolicy/private/hal_audio_route_default.te index fe83799..ee08d8e 100644 --- a/universal7885-common/sepolicy/private/hal_audio_route_default.te +++ b/universal7885-common/sepolicy/private/hal_audio_route_default.te @@ -1,7 +1,7 @@ type hal_audio_route_default, domain, coredomain; type hal_audio_route_default_exec, exec_type, file_type, system_file_type; -add_service(hal_audio_route_default, hal_fmradio_service); +add_service(hal_audio_route_default, hal_audio_route_service); init_daemon_domain(hal_audio_route_default); binder_use(hal_audio_route_default); diff --git a/universal7885-common/sepolicy/private/service.te b/universal7885-common/sepolicy/private/service.te index 43b4ca6..cb4bc06 100644 --- a/universal7885-common/sepolicy/private/service.te +++ b/universal7885-common/sepolicy/private/service.te @@ -1,2 +1,3 @@ type hal_parts_service, service_manager_type; type hal_fmradio_service, service_manager_type; +type hal_audio_route_service, service_manager_type;