Files
Bruno Martins 8e2b9ef1d7 powershare: Migrate to AIDL
Change-Id: I2ae661bf0069c7f1dbed3f5be4275efb9b763352
2025-05-10 11:48:31 +00:00

26 lines
756 B
C++

/*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#include "PowerShare.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using aidl::vendor::lineage::powershare::PowerShare;
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<PowerShare> powershare = ndk::SharedRefBase::make<PowerShare>();
const std::string instance = std::string(PowerShare::descriptor) + "/default";
binder_status_t status =
AServiceManager_addService(powershare->asBinder().get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
}