diff options
| author | Tim Murray <timmurray@google.com> | 2016-10-21 21:53:49 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2016-10-21 21:53:49 +0000 |
| commit | b9ede3dbbaca591e08bde4dfbed63d3bee43f95f (patch) | |
| tree | 27a13ed4f3ce04ca0f1ffff29389bf7daaa5d907 /healthd | |
| parent | 7650bc6318065583ae122a02180a22bec4ef9423 (diff) | |
| parent | 098babc7c80cebef1bc2c39802d805338410d3fe (diff) | |
| download | system_core-b9ede3dbbaca591e08bde4dfbed63d3bee43f95f.tar.gz system_core-b9ede3dbbaca591e08bde4dfbed63d3bee43f95f.tar.bz2 system_core-b9ede3dbbaca591e08bde4dfbed63d3bee43f95f.zip | |
healthd: move binder fd to not use EPOLLWAKEUP am: e89ea5eb85
am: 098babc7c8
Change-Id: I9ff934ef70aa89c02edcc8687249655ad86d806f
Diffstat (limited to 'healthd')
| -rw-r--r-- | healthd/healthd.cpp | 13 | ||||
| -rw-r--r-- | healthd/healthd_mode_charger.cpp | 2 | ||||
| -rw-r--r-- | healthd/include/healthd/healthd.h | 7 |
3 files changed, 15 insertions, 7 deletions
diff --git a/healthd/healthd.cpp b/healthd/healthd.cpp index 20a6bf6c3..97ed51df5 100644 --- a/healthd/healthd.cpp +++ b/healthd/healthd.cpp @@ -143,10 +143,14 @@ static void healthd_mode_nop_battery_update( struct android::BatteryProperties* /*props*/) { } -int healthd_register_event(int fd, void (*handler)(uint32_t)) { +int healthd_register_event(int fd, void (*handler)(uint32_t), EventWakeup wakeup) { struct epoll_event ev; - ev.events = EPOLLIN | EPOLLWAKEUP; + ev.events = EPOLLIN; + + if (wakeup == EVENT_WAKEUP_FD) + ev.events |= EPOLLWAKEUP; + ev.data.ptr = (void *)handler; if (epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &ev) == -1) { KLOG_ERROR(LOG_TAG, @@ -252,7 +256,7 @@ static void uevent_init(void) { } fcntl(uevent_fd, F_SETFL, O_NONBLOCK); - if (healthd_register_event(uevent_fd, uevent_event)) + if (healthd_register_event(uevent_fd, uevent_event, EVENT_WAKEUP_FD)) KLOG_ERROR(LOG_TAG, "register for uevent events failed\n"); } @@ -275,7 +279,7 @@ static void wakealarm_init(void) { return; } - if (healthd_register_event(wakealarm_fd, wakealarm_event)) + if (healthd_register_event(wakealarm_fd, wakealarm_event, EVENT_WAKEUP_FD)) KLOG_ERROR(LOG_TAG, "Registration of wakealarm event failed\n"); @@ -293,7 +297,6 @@ static void healthd_mainloop(void) { if (timeout < 0 || (mode_timeout > 0 && mode_timeout < timeout)) timeout = mode_timeout; nevents = epoll_wait(epollfd, events, eventct, timeout); - if (nevents == -1) { if (errno == EINTR) continue; diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp index 36c4664c4..243cbea86 100644 --- a/healthd/healthd_mode_charger.cpp +++ b/healthd/healthd_mode_charger.cpp @@ -839,7 +839,7 @@ void healthd_mode_charger_init(struct healthd_config* config) ret = ev_init(input_callback, charger); if (!ret) { epollfd = ev_get_epollfd(); - healthd_register_event(epollfd, charger_event_handler); + healthd_register_event(epollfd, charger_event_handler, EVENT_WAKEUP_FD); } struct animation* anim = init_animation(); diff --git a/healthd/include/healthd/healthd.h b/healthd/include/healthd/healthd.h index 34ea55f66..17efbd62a 100644 --- a/healthd/include/healthd/healthd.h +++ b/healthd/include/healthd/healthd.h @@ -73,9 +73,14 @@ struct healthd_config { bool (*screen_on)(android::BatteryProperties *props); }; +enum EventWakeup { + EVENT_NO_WAKEUP_FD, + EVENT_WAKEUP_FD, +}; + // Global helper functions -int healthd_register_event(int fd, void (*handler)(uint32_t)); +int healthd_register_event(int fd, void (*handler)(uint32_t), EventWakeup wakeup = EVENT_NO_WAKEUP_FD); void healthd_battery_update(); android::status_t healthd_get_property(int id, struct android::BatteryProperty *val); |
