diff options
author | Tom Marshall <tdm.code@gmail.com> | 2017-09-08 19:48:46 +0000 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2019-04-04 20:08:37 +0300 |
commit | cfcafa14542565a96ca9ddc54a65a2e3d9cd28d0 (patch) | |
tree | f22bfa524961f7922ec48f83e82026b2d40b5d11 | |
parent | a08c6f189260667dcafc4b65505c0829c2295404 (diff) | |
download | android_bootable_recovery-cfcafa14542565a96ca9ddc54a65a2e3d9cd28d0.tar.gz android_bootable_recovery-cfcafa14542565a96ca9ddc54a65a2e3d9cd28d0.tar.bz2 android_bootable_recovery-cfcafa14542565a96ca9ddc54a65a2e3d9cd28d0.zip |
recovery: Blank screen during shutdown and reboot
Some hardware doesn't like having the panel on and still
active during power cycles, so just turn it off.
(based on Ied1f0802f5a2d45980ee33abf2456a291ba64beb)
Change-Id: Ied6bbc3a32fd1c7cf6ea3ec1b2bee298520651c3
-rw-r--r-- | recovery.cpp | 2 | ||||
-rw-r--r-- | screen_ui.cpp | 5 | ||||
-rw-r--r-- | screen_ui.h | 1 | ||||
-rw-r--r-- | ui.cpp | 6 | ||||
-rw-r--r-- | ui.h | 2 |
5 files changed, 16 insertions, 0 deletions
diff --git a/recovery.cpp b/recovery.cpp index 7a987d0b..0349da3b 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -1879,6 +1879,8 @@ int main(int argc, char **argv) { sync(); + ui->Stop(); + switch (after) { case Device::SHUTDOWN: ui->Print("Shutting down...\n"); diff --git a/screen_ui.cpp b/screen_ui.cpp index c8fb5aa7..9fe6501f 100644 --- a/screen_ui.cpp +++ b/screen_ui.cpp @@ -637,6 +637,11 @@ bool ScreenRecoveryUI::Init(const std::string& locale) { return true; } +void ScreenRecoveryUI::Stop() { + RecoveryUI::Stop(); + gr_fb_blank(true); +} + void ScreenRecoveryUI::LoadAnimation() { std::unique_ptr<DIR, decltype(&closedir)> dir(opendir("/res/images"), closedir); dirent* de; diff --git a/screen_ui.h b/screen_ui.h index f05761c4..85b2695f 100644 --- a/screen_ui.h +++ b/screen_ui.h @@ -46,6 +46,7 @@ class ScreenRecoveryUI : public RecoveryUI { ScreenRecoveryUI(); bool Init(const std::string& locale) override; + void Stop() override; // overall recovery state ("background image") void SetBackground(Icon icon) override; @@ -220,6 +220,12 @@ bool RecoveryUI::Init(const std::string& /* locale */) { return true; } +void RecoveryUI::Stop() { + if (!android::base::WriteStringToFile("0", BRIGHTNESS_FILE)) { + PLOG(WARNING) << "Failed to write brightness file"; + } +} + void RecoveryUI::OnTouchEvent() { Point delta = touch_pos_ - touch_start_; enum SwipeDirection { UP, DOWN, RIGHT, LEFT } direction; @@ -102,6 +102,8 @@ class RecoveryUI { // the given locale. Returns true on success. virtual bool Init(const std::string& locale); + virtual void Stop(); + // Shows a stage indicator. Called immediately after Init(). virtual void SetStage(int current, int max) = 0; |