Files
device_samsung_a71-common/touch/service.cpp
Bruno Martins 6c21d28670 a71-common: touch: Migrate to AIDL
Change-Id: Ibbac9b4320fc64c5b6f365b8e9bd977d71d0d4dd
2025-09-02 18:51:48 +01:00

49 lines
1.9 KiB
C++

/*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "vendor.lineage.touch-service.samsung_sm6150"
#include "GloveMode.h"
#include "HighTouchPollingRate.h"
#include "TouchscreenGesture.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using aidl::vendor::lineage::touch::GloveMode;
using aidl::vendor::lineage::touch::HighTouchPollingRate;
using aidl::vendor::lineage::touch::TouchscreenGesture;
int main() {
binder_status_t status = STATUS_OK;
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<GloveMode> gm = ndk::SharedRefBase::make<GloveMode>();
if (gm->isSupported()) {
const std::string gm_instance = std::string(GloveMode::descriptor) + "/default";
status = AServiceManager_addService(gm->asBinder().get(), gm_instance.c_str());
CHECK_EQ(status, STATUS_OK) << "Failed to add service " << gm_instance << " " << status;
}
std::shared_ptr<HighTouchPollingRate> htpr = ndk::SharedRefBase::make<HighTouchPollingRate>();
if (htpr->isSupported()) {
const std::string htpr_instance = std::string(HighTouchPollingRate::descriptor) + "/default";
status = AServiceManager_addService(htpr->asBinder().get(), htpr_instance.c_str());
CHECK_EQ(status, STATUS_OK) << "Failed to add service " << htpr_instance << " " << status;
}
std::shared_ptr<TouchscreenGesture> tg = ndk::SharedRefBase::make<TouchscreenGesture>();
if (tg->isSupported()) {
const std::string tg_instance = std::string(TouchscreenGesture::descriptor) + "/default";
status = AServiceManager_addService(tg->asBinder().get(), tg_instance.c_str());
CHECK_EQ(status, STATUS_OK) << "Failed to add service " << tg_instance << " " << status;
}
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
}