summaryrefslogtreecommitdiffstats
path: root/gui/blanktimer.cpp
diff options
context:
space:
mode:
authorMatt Mower <mowerm@gmail.com>2016-01-21 01:12:47 +0100
committerDees Troy <dees_troy@teamw.in>2017-01-18 19:55:33 +0100
commit9472ba1d39e85b11c28d16b793fac1150ba153e5 (patch)
treea7d671186626ffe8c8b9a0bfb2d7e8c6bfc72424 /gui/blanktimer.cpp
parentSELinux can be assumed for Android 4.4+ (diff)
downloadandroid_bootable_recovery-9472ba1d39e85b11c28d16b793fac1150ba153e5.tar
android_bootable_recovery-9472ba1d39e85b11c28d16b793fac1150ba153e5.tar.gz
android_bootable_recovery-9472ba1d39e85b11c28d16b793fac1150ba153e5.tar.bz2
android_bootable_recovery-9472ba1d39e85b11c28d16b793fac1150ba153e5.tar.lz
android_bootable_recovery-9472ba1d39e85b11c28d16b793fac1150ba153e5.tar.xz
android_bootable_recovery-9472ba1d39e85b11c28d16b793fac1150ba153e5.tar.zst
android_bootable_recovery-9472ba1d39e85b11c28d16b793fac1150ba153e5.zip
Diffstat (limited to 'gui/blanktimer.cpp')
-rw-r--r--gui/blanktimer.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/gui/blanktimer.cpp b/gui/blanktimer.cpp
index 4662b1fab..220525387 100644
--- a/gui/blanktimer.cpp
+++ b/gui/blanktimer.cpp
@@ -116,3 +116,37 @@ void blanktimer::resetTimerAndUnblank(void) {
pthread_mutex_unlock(&mutex);
#endif
}
+
+void blanktimer::blank(void) {
+/* 1) No need for timer handling since checkForTimeout() verifies
+ * state of screen before performing screen-off
+ * 2) Assume screen-off causes issues for devices that set
+ * TW_NO_SCREEN_TIMEOUT and do not blank screen here either
+ */
+
+#ifndef TW_NO_SCREEN_TIMEOUT
+ pthread_mutex_lock(&mutex);
+ if (state == kOn) {
+ orig_brightness = getBrightness();
+ state = kOff;
+ TWFunc::Set_Brightness("0");
+ TWFunc::check_and_run_script("/sbin/postscreenblank.sh", "blank");
+ }
+#ifndef TW_NO_SCREEN_BLANK
+ if (state == kOff) {
+ gr_fb_blank(true);
+ state = kBlanked;
+ }
+#endif
+ pthread_mutex_unlock(&mutex);
+#endif
+}
+
+void blanktimer::toggleBlank(void) {
+ if (state == kOn) {
+ blank();
+ PageManager::ChangeOverlay("lock");
+ } else {
+ resetTimerAndUnblank();
+ }
+}