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

Commit b68a055c authored by Yifan Hong's avatar Yifan Hong Committed by Gerrit Code Review
Browse files

Merge "health 2.0: Check health_loop status for passthrough usage"

parents 1d53f956 55f1a1f3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -49,11 +49,14 @@ class HealthLoopAdapter : public HealthLoop {
static std::unique_ptr<HealthLoopAdapter> health_loop;

int healthd_register_event(int fd, void (*handler)(uint32_t), EventWakeup wakeup) {
    if (!health_loop) return -1;

    auto wrapped_handler = [handler](auto*, uint32_t epevents) { handler(epevents); };
    return health_loop->RegisterEvent(fd, wrapped_handler, wakeup);
}

void healthd_battery_update_internal(bool charger_online) {
    if (!health_loop) return;
    health_loop->AdjustWakealarmPeriods(charger_online);
}