diff options
Diffstat (limited to 'healthd')
-rw-r--r-- | healthd/healthd_draw.cpp | 7 | ||||
-rw-r--r-- | healthd/healthd_draw.h | 3 | ||||
-rw-r--r-- | healthd/healthd_mode_charger.cpp | 15 | ||||
-rw-r--r-- | healthd/include_charger/charger/healthd_mode_charger.h | 2 |
4 files changed, 26 insertions, 1 deletions
diff --git a/healthd/healthd_draw.cpp b/healthd/healthd_draw.cpp index 3e73fcd08..7c7931944 100644 --- a/healthd/healthd_draw.cpp +++ b/healthd/healthd_draw.cpp @@ -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); diff --git a/healthd/healthd_draw.h b/healthd/healthd_draw.h index 3d4abbdda..016db8e07 100644 --- a/healthd/healthd_draw.h +++ b/healthd/healthd_draw.h @@ -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: diff --git a/healthd/healthd_mode_charger.cpp b/healthd/healthd_mode_charger.cpp index aa98d4817..4aae27948 100644 --- a/healthd/healthd_mode_charger.cpp +++ b/healthd/healthd_mode_charger.cpp @@ -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; @@ -338,6 +350,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()) { diff --git a/healthd/include_charger/charger/healthd_mode_charger.h b/healthd/include_charger/charger/healthd_mode_charger.h index 28e1fb531..8957a7b22 100644 --- a/healthd/include_charger/charger/healthd_mode_charger.h +++ b/healthd/include_charger/charger/healthd_mode_charger.h @@ -107,9 +107,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; |