Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5c1eecd authored by Martijn Coenen's avatar Martijn Coenen
Browse files

healthd: Replace hwbinder-specific calls with generic ones.

To remove dependencies on libhwbinder.

Bug: 34388964
Test: sailfish boots
Change-Id: Ia1b8d8d8da91a510ef5739bac14236b7b3a9d3b9
parent 0327278a
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@

using android::hardware::IPCThreadState;
using android::hardware::configureRpcThreadpool;
using android::hardware::handleTransportPoll;
using android::hardware::setupTransportPolling;
using android::hardware::health::V1_0::HealthInfo;
using android::hardware::health::V1_0::hal_conversion::convertToHealthInfo;
using android::hardware::health::V2_0::IHealth;
@@ -35,21 +37,19 @@ using android::hardware::health::V2_0::implementation::Health;

extern int healthd_main(void);

static int gBinderFd = -1;

static void binder_event(uint32_t /*epevents*/) {
    IPCThreadState::self()->handlePolledCommands();
    if (gBinderFd >= 0) handleTransportPoll(gBinderFd);
}

void healthd_mode_service_2_0_init(struct healthd_config* config) {
    int binderFd;

    LOG(INFO) << LOG_TAG << " Hal is starting up...";

    configureRpcThreadpool(1, false /* callerWillJoin */);
    IPCThreadState::self()->disableBackgroundScheduling(true);
    IPCThreadState::self()->setupPolling(&binderFd);
    gBinderFd = setupTransportPolling();

    if (binderFd >= 0) {
        if (healthd_register_event(binderFd, binder_event))
    if (gBinderFd >= 0) {
        if (healthd_register_event(gBinderFd, binder_event))
            LOG(ERROR) << LOG_TAG << ": Register for binder events failed";
    }