universal7885: aidl-support: Fixup build errors

This commit is contained in:
roynatech2544 2022-10-16 14:17:02 +00:00
commit 41a3c2f0b1
7 changed files with 15 additions and 7 deletions

View file

@ -1 +1 @@
e5802a2cbeff18d06e61d70381d5f1b65f2448ca
97491c5753e9408d4a75687169e7b791ec19a907

View file

@ -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<IAudioFlinger> &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();;
}
}

View file

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

View file

@ -24,7 +24,7 @@ int main() {
ABinderProcess_setThreadPoolMaxThreadCount(3);
auto service = ndk::SharedRefBase::make<AudioRoute>();
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);

View file

@ -16,10 +16,12 @@
#include <fm_slsi-impl.h>
#include <android/binder_manager.h>
#include <cassert>
#include <fcntl.h>
#include <vendor/eureka/hardware/audio_route/BnAudioRoute.h>
#include <aidl/vendor/eureka/hardware/audio_route/BnAudioRoute.h>
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<audio_route::IAudioRoute> 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:

View file

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

View file

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