summaryrefslogtreecommitdiffstats
path: root/healthd
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-01-18 22:54:54 -0800
committerTao Bao <tbao@google.com>2017-01-18 23:02:45 -0800
commit92c260159a6b69f0317d7b66dd11a52772494e48 (patch)
tree28aa35376ac6d8b8caded80869bd0e85aedd8722 /healthd
parentc42bd0931fbe970e28dabee6c81ebd069355ac0c (diff)
downloadsystem_core-92c260159a6b69f0317d7b66dd11a52772494e48.tar.gz
system_core-92c260159a6b69f0317d7b66dd11a52772494e48.tar.bz2
system_core-92c260159a6b69f0317d7b66dd11a52772494e48.zip
healthd: Track the API change of minui/minui.h.
ev_init() and ev_iterate_available_keys() now take std::function callback functions. Test: mmma system/core/healthd Change-Id: I8231b57ba816fcba8f698dd7145724021e235664
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;