Loading healthd/healthd_mode_charger.cpp +29 −24 Original line number Diff line number Diff line Loading @@ -308,31 +308,8 @@ void Charger::UpdateScreenState(int64_t now) { // If timeout and battery level is still not ready, draw unknown battery } if (healthd_draw_ == nullptr) { std::optional<bool> out_screen_on = configuration_->ChargerShouldKeepScreenOn(); if (out_screen_on.has_value()) { if (!*out_screen_on) { LOGV("[%" PRId64 "] leave screen off\n", now); batt_anim_.run = false; next_screen_transition_ = -1; if (configuration_->ChargerIsOnline()) { RequestEnableSuspend(); } return; } } healthd_draw_ = HealthdDraw::Create(&batt_anim_); if (healthd_draw_ == nullptr) return; #if !defined(__ANDROID_VNDK__) if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) { healthd_draw_->blank_screen(true, static_cast<int>(drm_)); screen_blanked_ = true; } #endif } /* animation is over, blank screen and leave */ if (batt_anim_.num_cycles > 0 && batt_anim_.cur_cycle == batt_anim_.num_cycles) { reset_animation(&batt_anim_); Loading Loading @@ -736,6 +713,33 @@ void Charger::InitAnimation() { } } void Charger::InitHealthdDraw() { if (healthd_draw_ == nullptr) { std::optional<bool> out_screen_on = configuration_->ChargerShouldKeepScreenOn(); if (out_screen_on.has_value()) { if (!*out_screen_on) { LOGV("[%" PRId64 "] leave screen off\n", curr_time_ms()); batt_anim_.run = false; next_screen_transition_ = -1; if (configuration_->ChargerIsOnline()) { RequestEnableSuspend(); } return; } } healthd_draw_ = HealthdDraw::Create(&batt_anim_); if (healthd_draw_ == nullptr) return; #if !defined(__ANDROID_VNDK__) if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) { healthd_draw_->blank_screen(true, static_cast<int>(drm_)); screen_blanked_ = true; } #endif } } void Charger::OnInit(struct healthd_config* config) { int ret; int i; Loading @@ -753,6 +757,7 @@ void Charger::OnInit(struct healthd_config* config) { } InitAnimation(); InitHealthdDraw(); ret = CreateDisplaySurface(batt_anim_.fail_file, &surf_unknown_); if (ret < 0) { Loading healthd/include_charger/charger/healthd_mode_charger.h +1 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ class Charger { void HandleInputState(int64_t now); void HandlePowerSupplyState(int64_t now); int InputCallback(int fd, unsigned int epevents); void InitHealthdDraw(); void InitAnimation(); int RequestEnableSuspend(); int RequestDisableSuspend(); Loading Loading
healthd/healthd_mode_charger.cpp +29 −24 Original line number Diff line number Diff line Loading @@ -308,31 +308,8 @@ void Charger::UpdateScreenState(int64_t now) { // If timeout and battery level is still not ready, draw unknown battery } if (healthd_draw_ == nullptr) { std::optional<bool> out_screen_on = configuration_->ChargerShouldKeepScreenOn(); if (out_screen_on.has_value()) { if (!*out_screen_on) { LOGV("[%" PRId64 "] leave screen off\n", now); batt_anim_.run = false; next_screen_transition_ = -1; if (configuration_->ChargerIsOnline()) { RequestEnableSuspend(); } return; } } healthd_draw_ = HealthdDraw::Create(&batt_anim_); if (healthd_draw_ == nullptr) return; #if !defined(__ANDROID_VNDK__) if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) { healthd_draw_->blank_screen(true, static_cast<int>(drm_)); screen_blanked_ = true; } #endif } /* animation is over, blank screen and leave */ if (batt_anim_.num_cycles > 0 && batt_anim_.cur_cycle == batt_anim_.num_cycles) { reset_animation(&batt_anim_); Loading Loading @@ -736,6 +713,33 @@ void Charger::InitAnimation() { } } void Charger::InitHealthdDraw() { if (healthd_draw_ == nullptr) { std::optional<bool> out_screen_on = configuration_->ChargerShouldKeepScreenOn(); if (out_screen_on.has_value()) { if (!*out_screen_on) { LOGV("[%" PRId64 "] leave screen off\n", curr_time_ms()); batt_anim_.run = false; next_screen_transition_ = -1; if (configuration_->ChargerIsOnline()) { RequestEnableSuspend(); } return; } } healthd_draw_ = HealthdDraw::Create(&batt_anim_); if (healthd_draw_ == nullptr) return; #if !defined(__ANDROID_VNDK__) if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) { healthd_draw_->blank_screen(true, static_cast<int>(drm_)); screen_blanked_ = true; } #endif } } void Charger::OnInit(struct healthd_config* config) { int ret; int i; Loading @@ -753,6 +757,7 @@ void Charger::OnInit(struct healthd_config* config) { } InitAnimation(); InitHealthdDraw(); ret = CreateDisplaySurface(batt_anim_.fail_file, &surf_unknown_); if (ret < 0) { Loading
healthd/include_charger/charger/healthd_mode_charger.h +1 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,7 @@ class Charger { void HandleInputState(int64_t now); void HandlePowerSupplyState(int64_t now); int InputCallback(int fd, unsigned int epevents); void InitHealthdDraw(); void InitAnimation(); int RequestEnableSuspend(); int RequestDisableSuspend(); Loading