healthd: move binder fd to not use EPOLLWAKEUP
The binder fd doesn't need to use EPOLLWAKEUP and shouldn't; if it does,
it will prevent suspend unnecessarily.
bug 32180327
Change-Id: I292f1ada0c698290f6bd5518b237867ed69ec391
diff --git a/healthd/healthd.cpp b/healthd/healthd.cpp
index d9ac356..2caae78 100644
--- a/healthd/healthd.cpp
+++ b/healthd/healthd.cpp
@@ -136,10 +136,14 @@
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,
@@ -245,7 +249,7 @@
}
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");
}
@@ -268,7 +272,7 @@
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");
@@ -286,7 +290,6 @@
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;