summaryrefslogtreecommitdiffstats
path: root/gui/blanktimer.cpp
diff options
context:
space:
mode:
authorxNUTx <nut@fun-industries.nl>2014-07-18 01:30:58 +0200
committerEthan Yonker <dees_troy@teamw.in>2014-08-10 15:57:14 +0200
commite85f02dd9186079cf67a4d3e7d1657d248e28963 (patch)
tree839ccd8f8a2c9c67c33f84b6c96ec38405939c11 /gui/blanktimer.cpp
parentTW_SCREEN_BLANK_ON_BOOT will jolt the screen/touch driver. (diff)
downloadandroid_bootable_recovery-e85f02dd9186079cf67a4d3e7d1657d248e28963.tar
android_bootable_recovery-e85f02dd9186079cf67a4d3e7d1657d248e28963.tar.gz
android_bootable_recovery-e85f02dd9186079cf67a4d3e7d1657d248e28963.tar.bz2
android_bootable_recovery-e85f02dd9186079cf67a4d3e7d1657d248e28963.tar.lz
android_bootable_recovery-e85f02dd9186079cf67a4d3e7d1657d248e28963.tar.xz
android_bootable_recovery-e85f02dd9186079cf67a4d3e7d1657d248e28963.tar.zst
android_bootable_recovery-e85f02dd9186079cf67a4d3e7d1657d248e28963.zip
Diffstat (limited to 'gui/blanktimer.cpp')
-rw-r--r--gui/blanktimer.cpp40
1 files changed, 11 insertions, 29 deletions
diff --git a/gui/blanktimer.cpp b/gui/blanktimer.cpp
index 383b15724..1b184297b 100644
--- a/gui/blanktimer.cpp
+++ b/gui/blanktimer.cpp
@@ -97,11 +97,11 @@ int blanktimer::setClockTimer(void) {
if (sleepTimer > 2 && diff.tv_sec > (sleepTimer - 2) && conblank == 0) {
orig_brightness = getBrightness();
setConBlank(1);
- setBrightness(5);
+ TWFunc::Set_Brightness("5");
}
if (sleepTimer && diff.tv_sec > sleepTimer && conblank < 2) {
setConBlank(2);
- setBrightness(0);
+ TWFunc::Set_Brightness("0");
screenoff = true;
TWFunc::check_and_run_script("/sbin/postscreenblank.sh", "blank");
PageManager::ChangeOverlay("lock");
@@ -115,39 +115,20 @@ int blanktimer::setClockTimer(void) {
return -1; //shouldn't get here
}
-int blanktimer::getBrightness(void) {
- string results;
+string blanktimer::getBrightness(void) {
+ string result;
string brightness_path;
DataManager::GetValue("tw_brightness_file", brightness_path);
- if ((TWFunc::read_file(brightness_path, results)) != 0)
- return -1;
- int result = atoi(results.c_str());
- if (result == 0) {
- int tw_brightness;
- DataManager::GetValue("tw_brightness", tw_brightness);
- if (tw_brightness) {
- result = tw_brightness;
- } else {
- result = 255;
- }
+ if (brightness_path == "/nobrightness")
+ return brightness_path;
+ DataManager::GetValue("tw_brightness", result);
+ if (result == "") {
+ result = "255";
}
return result;
}
-int blanktimer::setBrightness(int brightness) {
- string brightness_path;
- string bstring;
- char buff[100];
- DataManager::GetValue("tw_brightness_file", brightness_path);
- sprintf(buff, "%d", brightness);
- bstring = buff;
- if ((TWFunc::write_file(brightness_path, bstring)) != 0)
- return -1;
- gui_forceRender();
- return 0;
-}
-
void blanktimer::resetTimerAndUnblank(void) {
setTimer();
switch (conblank) {
@@ -165,7 +146,8 @@ void blanktimer::resetTimerAndUnblank(void) {
screenoff = false;
// No break here, we want to keep going
case 1:
- setBrightness(orig_brightness);
+ if (orig_brightness != "/nobrightness")
+ TWFunc::Set_Brightness(orig_brightness);
setConBlank(0);
break;
}