bootable: Change how blank screen works
This is required on some devices where previous to 8.1/8.0 the blank
screen flag worked but don't now.
Test: Tested on begonia, screen is now no longer black
Change-Id: Ib4ff607d220bcb1aa5166fea23cc7ecb0e012fdd
(cherry picked from commit 28d8dec40d60a31309fcf6259dad38cd328f0717)
diff --git a/gui/Android.mk b/gui/Android.mk
index 33e870f..d9cae7f 100755
--- a/gui/Android.mk
+++ b/gui/Android.mk
@@ -119,6 +119,9 @@
ifeq ($(AB_OTA_UPDATER),true)
LOCAL_CFLAGS += -DAB_OTA_UPDATER=1
endif
+ifeq ($(TW_SCREEN_BLANK_ON_BOOT), true)
+ LOCAL_CFLAGS += -DTW_SCREEN_BLANK_ON_BOOT
+endif
LOCAL_C_INCLUDES += \
bionic \
diff --git a/gui/blanktimer.hpp b/gui/blanktimer.hpp
index fe7b77c..6aca270 100644
--- a/gui/blanktimer.hpp
+++ b/gui/blanktimer.hpp
@@ -42,10 +42,11 @@
bool isScreenOff();
+ void blank(void);
+
private:
void setTimer(void);
string getBrightness(void);
- void blank(void);
pthread_mutex_t mutex;
enum State { kOn = 0, kDim = 1, kOff = 2, kBlanked = 3 };
diff --git a/gui/gui.cpp b/gui/gui.cpp
index 2a36fec..da35d23 100755
--- a/gui/gui.cpp
+++ b/gui/gui.cpp
@@ -755,6 +755,12 @@
gr_init();
TWFunc::Set_Brightness(DataManager::GetStrValue("tw_brightness"));
+#ifdef TW_SCREEN_BLANK_ON_BOOT
+ printf("TW_SCREEN_BLANK_ON_BOOT := true\n");
+ blankTimer.blank();
+ blankTimer.resetTimerAndUnblank();
+#endif
+
// load and show splash screen
if (PageManager::LoadPackage("splash", TWRES "splash.xml", "splash")) {
LOGERR("Failed to load splash screen XML.\n");
diff --git a/minuitwrp/Android.mk b/minuitwrp/Android.mk
index d1c01e0..f5eec9c 100644
--- a/minuitwrp/Android.mk
+++ b/minuitwrp/Android.mk
@@ -150,9 +150,6 @@
else
LOCAL_CFLAGS += -DOVERSCAN_PERCENT=0
endif
-ifeq ($(TW_SCREEN_BLANK_ON_BOOT), true)
- LOCAL_CFLAGS += -DTW_SCREEN_BLANK_ON_BOOT
-endif
ifeq ($(TW_FBIOPAN), true)
LOCAL_CFLAGS += -DTW_FBIOPAN
endif
diff --git a/minuitwrp/graphics.cpp b/minuitwrp/graphics.cpp
index 35ffaeb..e173437 100755
--- a/minuitwrp/graphics.cpp
+++ b/minuitwrp/graphics.cpp
@@ -436,12 +436,6 @@
gr_flip();
gr_flip();
-#ifdef TW_SCREEN_BLANK_ON_BOOT
- printf("TW_SCREEN_BLANK_ON_BOOT := true\n");
- gr_fb_blank(true);
- gr_fb_blank(false);
-#endif
-
return 0;
}