Merge "charger: support screen rotation" am: e72c5c76db
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1867821 Change-Id: I203db3e21f78d7ddda93756d105c472fbfcc02a6
This commit is contained in:
commit
07f1804075
3 changed files with 13 additions and 0 deletions
|
@ -99,6 +99,15 @@ void HealthdDraw::blank_screen(bool blank, int drm) {
|
|||
gr_fb_blank(blank, drm);
|
||||
}
|
||||
|
||||
/* support screen rotation for foldable phone */
|
||||
void HealthdDraw::rotate_screen(int drm) {
|
||||
if (!graphics_available) return;
|
||||
if (drm == 0)
|
||||
gr_rotate(GRRotation::RIGHT /* landscape mode */);
|
||||
else
|
||||
gr_rotate(GRRotation::NONE /* Portrait mode */);
|
||||
}
|
||||
|
||||
void HealthdDraw::clear_screen(void) {
|
||||
if (!graphics_available) return;
|
||||
gr_color(0, 0, 0, 255);
|
||||
|
|
|
@ -35,6 +35,9 @@ class HealthdDraw {
|
|||
// Blanks screen if true, unblanks if false.
|
||||
virtual void blank_screen(bool blank, int drm);
|
||||
|
||||
// Rotate screen.
|
||||
virtual void rotate_screen(int drm);
|
||||
|
||||
static std::unique_ptr<HealthdDraw> Create(animation *anim);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -352,6 +352,7 @@ void Charger::UpdateScreenState(int64_t now) {
|
|||
if (screen_switch_ == SCREEN_SWITCH_ENABLE) {
|
||||
healthd_draw_->blank_screen(true, 0 /* drm */);
|
||||
healthd_draw_->blank_screen(true, 1 /* drm */);
|
||||
healthd_draw_->rotate_screen(static_cast<int>(drm_));
|
||||
screen_blanked_ = true;
|
||||
screen_switch_ = SCREEN_SWITCH_DISABLE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue