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
diff --git a/recovery_ui/include/recovery_ui/screen_ui.h b/recovery_ui/include/recovery_ui/screen_ui.h
index 5cda2a2..bb0ab77 100644
--- a/recovery_ui/include/recovery_ui/screen_ui.h
+++ b/recovery_ui/include/recovery_ui/screen_ui.h
@@ -303,6 +303,7 @@
void PutChar(char);
void ClearText();
+ void Stop() override;
void LoadAnimation();
std::unique_ptr<GRSurface> LoadBitmap(const std::string& filename);
std::unique_ptr<GRSurface> LoadLocalizedBitmap(const std::string& filename);
diff --git a/recovery_ui/include/recovery_ui/ui.h b/recovery_ui/include/recovery_ui/ui.h
index a28e15d..58fef6c 100644
--- a/recovery_ui/include/recovery_ui/ui.h
+++ b/recovery_ui/include/recovery_ui/ui.h
@@ -110,6 +110,8 @@
// to the given locale. Returns true on success.
virtual bool Init(const std::string& locale);
+ virtual void Stop();
+
virtual std::string GetLocale() const = 0;
// Shows a stage indicator. Called immediately after Init().
diff --git a/recovery_ui/screen_ui.cpp b/recovery_ui/screen_ui.cpp
index 17b0890..112620c 100644
--- a/recovery_ui/screen_ui.cpp
+++ b/recovery_ui/screen_ui.cpp
@@ -922,6 +922,11 @@
return locale_;
}
+void ScreenRecoveryUI::Stop() {
+ RecoveryUI::Stop();
+ gr_fb_blank(true);
+}
+
void ScreenRecoveryUI::LoadAnimation() {
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(Paths::Get().resource_dir().c_str()),
closedir);
diff --git a/recovery_ui/ui.cpp b/recovery_ui/ui.cpp
index aed6f49..aced5b0 100644
--- a/recovery_ui/ui.cpp
+++ b/recovery_ui/ui.cpp
@@ -223,6 +223,12 @@
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;