Loading healthd/healthd_draw.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -94,9 +94,9 @@ void HealthdDraw::redraw_screen(const animation* batt_anim, GRSurface* surf_unkn gr_flip(); } void HealthdDraw::blank_screen(bool blank) { void HealthdDraw::blank_screen(bool blank, int drm) { if (!graphics_available) return; gr_fb_blank(blank); gr_fb_blank(blank, drm); } void HealthdDraw::clear_screen(void) { Loading Loading @@ -139,6 +139,8 @@ int HealthdDraw::draw_text(const GRFont* font, int x, int y, const char* str) { void HealthdDraw::determine_xy(const animation::text_field& field, const int length, int* x, int* y) { *x = field.pos_x; screen_width_ = gr_fb_width() / (kSplitScreen ? 2 : 1); screen_height_ = gr_fb_height(); int str_len_px = length * field.font->char_width; if (field.pos_x == CENTER_VAL) { Loading healthd/healthd_draw.h +2 −1 Original line number Diff line number Diff line Loading @@ -31,8 +31,9 @@ class HealthdDraw { // Redraws screen. void redraw_screen(const animation* batt_anim, GRSurface* surf_unknown); // According to the index of Direct Rendering Manager, // Blanks screen if true, unblanks if false. virtual void blank_screen(bool blank); virtual void blank_screen(bool blank, int drm); static std::unique_ptr<HealthdDraw> Create(animation *anim); Loading healthd/healthd_mode_charger.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -327,7 +327,7 @@ void Charger::UpdateScreenState(int64_t now) { #if !defined(__ANDROID_VNDK__) if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) { healthd_draw_->blank_screen(true); healthd_draw_->blank_screen(true, static_cast<int>(drm_)); screen_blanked_ = true; } #endif Loading @@ -337,7 +337,7 @@ void Charger::UpdateScreenState(int64_t now) { if (batt_anim_.num_cycles > 0 && batt_anim_.cur_cycle == batt_anim_.num_cycles) { reset_animation(&batt_anim_); next_screen_transition_ = -1; healthd_draw_->blank_screen(true); healthd_draw_->blank_screen(true, static_cast<int>(drm_)); screen_blanked_ = true; LOGV("[%" PRId64 "] animation done\n", now); if (configuration_->ChargerIsOnline()) { Loading @@ -349,7 +349,7 @@ void Charger::UpdateScreenState(int64_t now) { disp_time = batt_anim_.frames[batt_anim_.cur_frame].disp_time; if (screen_blanked_) { healthd_draw_->blank_screen(false); healthd_draw_->blank_screen(false, static_cast<int>(drm_)); screen_blanked_ = false; } Loading Loading @@ -743,6 +743,7 @@ void Charger::OnInit(struct healthd_config* config) { batt_anim_.frames[i].surface = scale_frames[i]; } } drm_ = DRM_INNER; ev_sync_key_state(std::bind(&Charger::SetKeyCallback, this, std::placeholders::_1, std::placeholders::_2)); Loading healthd/include_charger/charger/healthd_mode_charger.h +7 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ struct ChargerHealthInfo { aidl::android::hardware::health::BatteryStatus battery_status; }; enum DirectRenderManager { DRM_INNER, DRM_OUTER, }; // Configuration interface for charger. This includes: // - HalHealthLoop APIs that interests charger. // - configuration values that used to be provided by sysprops Loading Loading @@ -102,6 +107,8 @@ class Charger { int64_t next_pwr_check_ = 0; int64_t wait_batt_level_timestamp_ = 0; DirectRenderManager drm_; key_state keys_[KEY_MAX + 1] = {}; animation batt_anim_; Loading Loading
healthd/healthd_draw.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -94,9 +94,9 @@ void HealthdDraw::redraw_screen(const animation* batt_anim, GRSurface* surf_unkn gr_flip(); } void HealthdDraw::blank_screen(bool blank) { void HealthdDraw::blank_screen(bool blank, int drm) { if (!graphics_available) return; gr_fb_blank(blank); gr_fb_blank(blank, drm); } void HealthdDraw::clear_screen(void) { Loading Loading @@ -139,6 +139,8 @@ int HealthdDraw::draw_text(const GRFont* font, int x, int y, const char* str) { void HealthdDraw::determine_xy(const animation::text_field& field, const int length, int* x, int* y) { *x = field.pos_x; screen_width_ = gr_fb_width() / (kSplitScreen ? 2 : 1); screen_height_ = gr_fb_height(); int str_len_px = length * field.font->char_width; if (field.pos_x == CENTER_VAL) { Loading
healthd/healthd_draw.h +2 −1 Original line number Diff line number Diff line Loading @@ -31,8 +31,9 @@ class HealthdDraw { // Redraws screen. void redraw_screen(const animation* batt_anim, GRSurface* surf_unknown); // According to the index of Direct Rendering Manager, // Blanks screen if true, unblanks if false. virtual void blank_screen(bool blank); virtual void blank_screen(bool blank, int drm); static std::unique_ptr<HealthdDraw> Create(animation *anim); Loading
healthd/healthd_mode_charger.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -327,7 +327,7 @@ void Charger::UpdateScreenState(int64_t now) { #if !defined(__ANDROID_VNDK__) if (android::sysprop::ChargerProperties::disable_init_blank().value_or(false)) { healthd_draw_->blank_screen(true); healthd_draw_->blank_screen(true, static_cast<int>(drm_)); screen_blanked_ = true; } #endif Loading @@ -337,7 +337,7 @@ void Charger::UpdateScreenState(int64_t now) { if (batt_anim_.num_cycles > 0 && batt_anim_.cur_cycle == batt_anim_.num_cycles) { reset_animation(&batt_anim_); next_screen_transition_ = -1; healthd_draw_->blank_screen(true); healthd_draw_->blank_screen(true, static_cast<int>(drm_)); screen_blanked_ = true; LOGV("[%" PRId64 "] animation done\n", now); if (configuration_->ChargerIsOnline()) { Loading @@ -349,7 +349,7 @@ void Charger::UpdateScreenState(int64_t now) { disp_time = batt_anim_.frames[batt_anim_.cur_frame].disp_time; if (screen_blanked_) { healthd_draw_->blank_screen(false); healthd_draw_->blank_screen(false, static_cast<int>(drm_)); screen_blanked_ = false; } Loading Loading @@ -743,6 +743,7 @@ void Charger::OnInit(struct healthd_config* config) { batt_anim_.frames[i].surface = scale_frames[i]; } } drm_ = DRM_INNER; ev_sync_key_state(std::bind(&Charger::SetKeyCallback, this, std::placeholders::_1, std::placeholders::_2)); Loading
healthd/include_charger/charger/healthd_mode_charger.h +7 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,11 @@ struct ChargerHealthInfo { aidl::android::hardware::health::BatteryStatus battery_status; }; enum DirectRenderManager { DRM_INNER, DRM_OUTER, }; // Configuration interface for charger. This includes: // - HalHealthLoop APIs that interests charger. // - configuration values that used to be provided by sysprops Loading Loading @@ -102,6 +107,8 @@ class Charger { int64_t next_pwr_check_ = 0; int64_t wait_batt_level_timestamp_ = 0; DirectRenderManager drm_; key_state keys_[KEY_MAX + 1] = {}; animation batt_anim_; Loading