charger: fix secondary display not turning off after first display was off
turn off both display after first display was turned off Bug: 242967285 Test: charging animation can show in display correctly Signed-off-by: Jack Wu <wjack@google.com> Change-Id: Ie5741b49322aaf8a3750b1977fb203e4d0df3539
This commit is contained in:
parent
44e21ec352
commit
20b8a015c0
4 changed files with 26 additions and 1 deletions
|
@ -99,7 +99,7 @@ void HealthdDraw::blank_screen(bool blank, int drm) {
|
|||
gr_fb_blank(blank, drm);
|
||||
}
|
||||
|
||||
/* support screen rotation for foldable phone */
|
||||
// support screen rotation for foldable phone
|
||||
void HealthdDraw::rotate_screen(int drm) {
|
||||
if (!graphics_available) return;
|
||||
if (drm == 0)
|
||||
|
@ -108,6 +108,11 @@ void HealthdDraw::rotate_screen(int drm) {
|
|||
gr_rotate(GRRotation::NONE /* Portrait mode */);
|
||||
}
|
||||
|
||||
// detect dual display
|
||||
bool HealthdDraw::has_multiple_connectors() {
|
||||
return graphics_available && gr_has_multiple_connectors();
|
||||
}
|
||||
|
||||
void HealthdDraw::clear_screen(void) {
|
||||
if (!graphics_available) return;
|
||||
gr_color(0, 0, 0, 255);
|
||||
|
|
|
@ -38,6 +38,9 @@ class HealthdDraw {
|
|||
// Rotate screen.
|
||||
virtual void rotate_screen(int drm);
|
||||
|
||||
// Detect dual display
|
||||
virtual bool has_multiple_connectors();
|
||||
|
||||
static std::unique_ptr<HealthdDraw> Create(animation *anim);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -289,6 +289,18 @@ static void reset_animation(animation* anim) {
|
|||
anim->run = false;
|
||||
}
|
||||
|
||||
void Charger::BlankSecScreen() {
|
||||
int drm = drm_ == DRM_INNER ? 1 : 0;
|
||||
|
||||
if (!init_screen_) {
|
||||
/* blank the secondary screen */
|
||||
healthd_draw_->blank_screen(false, drm);
|
||||
healthd_draw_->redraw_screen(&batt_anim_, surf_unknown_);
|
||||
healthd_draw_->blank_screen(true, drm);
|
||||
init_screen_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Charger::UpdateScreenState(int64_t now) {
|
||||
int disp_time;
|
||||
|
||||
|
@ -315,6 +327,9 @@ void Charger::UpdateScreenState(int64_t now) {
|
|||
reset_animation(&batt_anim_);
|
||||
next_screen_transition_ = -1;
|
||||
healthd_draw_->blank_screen(true, static_cast<int>(drm_));
|
||||
if (healthd_draw_->has_multiple_connectors()) {
|
||||
BlankSecScreen();
|
||||
}
|
||||
screen_blanked_ = true;
|
||||
LOGV("[%" PRId64 "] animation done\n", now);
|
||||
if (configuration_->ChargerIsOnline()) {
|
||||
|
|
|
@ -108,9 +108,11 @@ class Charger {
|
|||
void InitAnimation();
|
||||
int RequestEnableSuspend();
|
||||
int RequestDisableSuspend();
|
||||
void BlankSecScreen();
|
||||
|
||||
bool have_battery_state_ = false;
|
||||
bool screen_blanked_ = false;
|
||||
bool init_screen_ = false;
|
||||
int64_t next_screen_transition_ = 0;
|
||||
int64_t next_key_check_ = 0;
|
||||
int64_t next_pwr_check_ = 0;
|
||||
|
|
Loading…
Reference in a new issue