diff options
-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; |