mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 17:31:58 +00:00
Merge "boot: use defaultPassthroughServiceImplementation"
am: da32114e26
Change-Id: I6e9a58b0ff2dc98a646c366b33ce12f2bb2ddaa9
This commit is contained in:
@@ -1,44 +1,11 @@
|
||||
#define LOG_TAG "android.hardware.boot@1.0-service"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/hardware/boot/1.0/IBootControl.h>
|
||||
|
||||
#include <hidl/IServiceManager.h>
|
||||
#include <hwbinder/IPCThreadState.h>
|
||||
#include <hwbinder/ProcessState.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/StrongPointer.h>
|
||||
|
||||
using android::sp;
|
||||
|
||||
using android::hardware::IPCThreadState;
|
||||
using android::hardware::ProcessState;
|
||||
#include <hidl/LegacySupport.h>
|
||||
|
||||
using ::android::hardware::boot::V1_0::IBootControl;
|
||||
using android::hardware::defaultPassthroughServiceImplementation;
|
||||
|
||||
int main (int /* argc */, char * /* argv */ []) {
|
||||
ALOGI("Service is starting.");
|
||||
const char instance[] = "bootctrl";
|
||||
ALOGI("Retrieving default implementation of instance %s.",
|
||||
instance);
|
||||
|
||||
sp<IBootControl> service = IBootControl::getService(instance, true /* getStub */);
|
||||
|
||||
if (service.get() == nullptr) {
|
||||
ALOGE("IBootControl::getService returned NULL, exiting");
|
||||
return -1;
|
||||
}
|
||||
|
||||
LOG_FATAL_IF(service->isRemote(), "Implementation is REMOTE!");
|
||||
|
||||
ALOGI("Registering instance %s.", instance);
|
||||
service->registerAsService(instance);
|
||||
ALOGI("Ready.");
|
||||
|
||||
ProcessState::self()->setThreadPoolMaxThreadCount(0);
|
||||
ProcessState::self()->startThreadPool();
|
||||
IPCThreadState::self()->joinThreadPool();
|
||||
return defaultPassthroughServiceImplementation<IBootControl>("bootctrl");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user