diff options
author | Tao Bao | 2017-01-19 00:54:54 -0600 |
---|---|---|
committer | Tao Bao | 2017-01-19 01:02:45 -0600 |
commit | 92c260159a6b69f0317d7b66dd11a52772494e48 (patch) | |
tree | 28aa35376ac6d8b8caded80869bd0e85aedd8722 /healthd/healthd_mode_charger.cpp | |
parent | c42bd0931fbe970e28dabee6c81ebd069355ac0c (diff) | |
download | platform-system-core-92c260159a6b69f0317d7b66dd11a52772494e48.tar.gz platform-system-core-92c260159a6b69f0317d7b66dd11a52772494e48.tar.xz platform-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/healthd_mode_charger.cpp')
-rw-r--r-- | healthd/healthd_mode_charger.cpp | 18 |
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 @@ | |||
30 | #include <time.h> | 30 | #include <time.h> |
31 | #include <unistd.h> | 31 | #include <unistd.h> |
32 | 32 | ||
33 | #include <functional> | ||
34 | |||
33 | #include <android-base/file.h> | 35 | #include <android-base/file.h> |
34 | #include <android-base/stringprintf.h> | 36 | #include <android-base/stringprintf.h> |
35 | 37 | ||
@@ -42,6 +44,7 @@ | |||
42 | #include <cutils/misc.h> | 44 | #include <cutils/misc.h> |
43 | #include <cutils/uevent.h> | 45 | #include <cutils/uevent.h> |
44 | #include <cutils/properties.h> | 46 | #include <cutils/properties.h> |
47 | #include <minui/minui.h> | ||
45 | 48 | ||
46 | #ifdef CHARGER_ENABLE_SUSPEND | 49 | #ifdef CHARGER_ENABLE_SUSPEND |
47 | #include <suspend/autosuspend.h> | 50 | #include <suspend/autosuspend.h> |
@@ -49,7 +52,6 @@ | |||
49 | 52 | ||
50 | #include "animation.h" | 53 | #include "animation.h" |
51 | #include "AnimationParser.h" | 54 | #include "AnimationParser.h" |
52 | #include "minui/minui.h" | ||
53 | 55 | ||
54 | #include <healthd/healthd.h> | 56 | #include <healthd/healthd.h> |
55 | 57 | ||
@@ -563,9 +565,8 @@ static void update_screen_state(struct charger *charger, int64_t now) | |||
563 | } | 565 | } |
564 | } | 566 | } |
565 | 567 | ||
566 | static int set_key_callback(int code, int value, void *data) | 568 | static int set_key_callback(struct charger *charger, int code, int value) |
567 | { | 569 | { |
568 | struct charger *charger = (struct charger *)data; | ||
569 | int64_t now = curr_time_ms(); | 570 | int64_t now = curr_time_ms(); |
570 | int down = !!value; | 571 | int down = !!value; |
571 | 572 | ||
@@ -600,7 +601,7 @@ static void update_input_state(struct charger *charger, | |||
600 | { | 601 | { |
601 | if (ev->type != EV_KEY) | 602 | if (ev->type != EV_KEY) |
602 | return; | 603 | return; |
603 | set_key_callback(ev->code, ev->value, charger); | 604 | set_key_callback(charger, ev->code, ev->value); |
604 | } | 605 | } |
605 | 606 | ||
606 | static void set_next_key_check(struct charger *charger, | 607 | static void set_next_key_check(struct charger *charger, |
@@ -757,9 +758,8 @@ int healthd_mode_charger_preparetowait(void) | |||
757 | return (int)timeout; | 758 | return (int)timeout; |
758 | } | 759 | } |
759 | 760 | ||
760 | static int input_callback(int fd, unsigned int epevents, void *data) | 761 | static int input_callback(struct charger *charger, int fd, unsigned int epevents) |
761 | { | 762 | { |
762 | struct charger *charger = (struct charger *)data; | ||
763 | struct input_event ev; | 763 | struct input_event ev; |
764 | int ret; | 764 | int ret; |
765 | 765 | ||
@@ -836,7 +836,8 @@ void healthd_mode_charger_init(struct healthd_config* config) | |||
836 | 836 | ||
837 | LOGW("--------------- STARTING CHARGER MODE ---------------\n"); | 837 | LOGW("--------------- STARTING CHARGER MODE ---------------\n"); |
838 | 838 | ||
839 | ret = ev_init(input_callback, charger); | 839 | ret = ev_init(std::bind(&input_callback, charger, std::placeholders::_1, |
840 | std::placeholders::_2)); | ||
840 | if (!ret) { | 841 | if (!ret) { |
841 | epollfd = ev_get_epollfd(); | 842 | epollfd = ev_get_epollfd(); |
842 | healthd_register_event(epollfd, charger_event_handler); | 843 | healthd_register_event(epollfd, charger_event_handler); |
@@ -875,7 +876,8 @@ void healthd_mode_charger_init(struct healthd_config* config) | |||
875 | anim->frames[i].surface = scale_frames[i]; | 876 | anim->frames[i].surface = scale_frames[i]; |
876 | } | 877 | } |
877 | } | 878 | } |
878 | ev_sync_key_state(set_key_callback, charger); | 879 | ev_sync_key_state(std::bind(&set_key_callback, charger, std::placeholders::_1, |
880 | std::placeholders::_2)); | ||
879 | 881 | ||
880 | charger->next_screen_transition = -1; | 882 | charger->next_screen_transition = -1; |
881 | charger->next_key_check = -1; | 883 | charger->next_key_check = -1; |