summaryrefslogtreecommitdiffstats
path: root/healthd
diff options
context:
space:
mode:
Diffstat (limited to 'healthd')
-rw-r--r--healthd/healthd_mode_charger.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp
index 36c4664c4..2f6937201 100644
--- a/healthd/healthd_mode_charger.cpp
+++ b/healthd/healthd_mode_charger.cpp
@@ -30,6 +30,8 @@
#include <time.h>
#include <unistd.h>
+#include <functional>
+
#include <android-base/file.h>
#include <android-base/stringprintf.h>
@@ -42,6 +44,7 @@
#include <cutils/misc.h>
#include <cutils/uevent.h>
#include <cutils/properties.h>
+#include <minui/minui.h>
#ifdef CHARGER_ENABLE_SUSPEND
#include <suspend/autosuspend.h>
@@ -49,7 +52,6 @@
#include "animation.h"
#include "AnimationParser.h"
-#include "minui/minui.h"
#include <healthd/healthd.h>
@@ -563,9 +565,8 @@ static void update_screen_state(struct charger *charger, int64_t now)
}
}
-static int set_key_callback(int code, int value, void *data)
+static int set_key_callback(struct charger *charger, int code, int value)
{
- struct charger *charger = (struct charger *)data;
int64_t now = curr_time_ms();
int down = !!value;
@@ -600,7 +601,7 @@ static void update_input_state(struct charger *charger,
{
if (ev->type != EV_KEY)
return;
- set_key_callback(ev->code, ev->value, charger);
+ set_key_callback(charger, ev->code, ev->value);
}
static void set_next_key_check(struct charger *charger,
@@ -757,9 +758,8 @@ int healthd_mode_charger_preparetowait(void)
return (int)timeout;
}
-static int input_callback(int fd, unsigned int epevents, void *data)
+static int input_callback(struct charger *charger, int fd, unsigned int epevents)
{
- struct charger *charger = (struct charger *)data;
struct input_event ev;
int ret;
@@ -836,7 +836,8 @@ void healthd_mode_charger_init(struct healthd_config* config)
LOGW("--------------- STARTING CHARGER MODE ---------------\n");
- ret = ev_init(input_callback, charger);
+ ret = ev_init(std::bind(&input_callback, charger, std::placeholders::_1,
+ std::placeholders::_2));
if (!ret) {
epollfd = ev_get_epollfd();
healthd_register_event(epollfd, charger_event_handler);
@@ -875,7 +876,8 @@ void healthd_mode_charger_init(struct healthd_config* config)
anim->frames[i].surface = scale_frames[i];
}
}
- ev_sync_key_state(set_key_callback, charger);
+ ev_sync_key_state(std::bind(&set_key_callback, charger, std::placeholders::_1,
+ std::placeholders::_2));
charger->next_screen_transition = -1;
charger->next_key_check = -1;