healthd: charger use health 2.0 HAL

Test: charger_test
Test: off-mode charging, charger runs correctly
Bug: 63702641
Bug: 69268160
Change-Id: I7dfc83ae4020ada7e9d11ab955f648abb74f435b
This commit is contained in:
Yifan Hong 2017-11-08 10:57:52 -08:00
parent 3bc12ce7df
commit 10c2b4013a
3 changed files with 20 additions and 2 deletions

View File

@ -47,6 +47,8 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := \
android.hardware.health@2.0 \
android.hardware.health@1.0 \
libminui \
libpng \
libz \
@ -74,7 +76,6 @@ LOCAL_CHARGER_NO_UI := true
endif
LOCAL_SRC_FILES := \
healthd_common.cpp \
charger.cpp \
LOCAL_MODULE := charger
@ -96,6 +97,13 @@ LOCAL_CFLAGS += -DBOARD_PERIODIC_CHORES_INTERVAL_SLOW=$(BOARD_PERIODIC_CHORES_IN
endif
LOCAL_STATIC_LIBRARIES := \
android.hardware.health@2.0-impl \
android.hardware.health@2.0 \
android.hardware.health@1.0 \
libhidltransport \
libhidlbase \
libhwbinder \
libvndksupport \
libhealthd_charger \
libhealthd_draw \
libbatterymonitor \

View File

@ -17,6 +17,7 @@
#define LOG_TAG "charger"
#define KLOG_LEVEL 6
#include <health2/Health.h>
#include <healthd/healthd.h>
#include <stdlib.h>
@ -62,7 +63,9 @@ static struct healthd_mode_ops charger_ops = {
};
#endif
static void healthd_mode_nop_init(struct healthd_config* /*config*/) {
static void healthd_mode_nop_init(struct healthd_config* config) {
using android::hardware::health::V2_0::implementation::Health;
Health::initInstance(config);
}
static int healthd_mode_nop_preparetowait(void) {

View File

@ -49,6 +49,7 @@
#include "AnimationParser.h"
#include "healthd_draw.h"
#include <health2/Health.h>
#include <healthd/healthd.h>
using namespace android;
@ -612,6 +613,8 @@ animation* init_animation() {
}
void healthd_mode_charger_init(struct healthd_config* config) {
using android::hardware::health::V2_0::implementation::Health;
int ret;
charger* charger = &charger_state;
int i;
@ -666,6 +669,10 @@ void healthd_mode_charger_init(struct healthd_config* config) {
charger->next_screen_transition = -1;
charger->next_key_check = -1;
charger->next_pwr_check = -1;
// Initialize Health implementation (which initializes the internal BatteryMonitor).
Health::initInstance(config);
healthd_config = config;
charger->boot_min_cap = config->boot_min_cap;
}