From c9ecd4473c5763fe6c372e6fead1cc1f6b7714cf Mon Sep 17 00:00:00 2001 From: Ricardo Gomez Date: Fri, 5 Jul 2013 16:13:52 -0700 Subject: Add a TW_NO_TIMEOUT option Change-Id: Ifb3a5bd9f1e6c2e9810c90b0aec198e91d5956fc --- gui/Android.mk | 3 +++ gui/action.cpp | 7 ++++++- gui/devices/1024x600/res/ui.xml | 3 +++ gui/devices/1024x768/res/ui.xml | 3 +++ gui/devices/1080x1920/res/ui.xml | 3 +++ gui/devices/1280x800/res/ui.xml | 3 +++ gui/devices/1920x1200/res/ui.xml | 3 +++ gui/devices/2560x1600/res/ui.xml | 3 +++ gui/devices/320x480/res/ui.xml | 3 +++ gui/devices/480x800/res/ui.xml | 3 +++ gui/devices/480x854/res/ui.xml | 3 +++ gui/devices/540x960/res/ui.xml | 3 +++ gui/devices/720x1280/res/ui.xml | 3 +++ gui/devices/800x1280/res/ui.xml | 3 +++ gui/devices/800x480/res/ui.xml | 3 +++ gui/gui.cpp | 30 ++++++++++++++++++++++++++++++ gui/pages.cpp | 7 ++++++- 17 files changed, 84 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/Android.mk b/gui/Android.mk index 7ac4bac9b..18decd047 100644 --- a/gui/Android.mk +++ b/gui/Android.mk @@ -61,6 +61,9 @@ endif ifneq ($(TW_NO_SCREEN_BLANK),) LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK endif +ifneq ($(TW_NO_SCREEN_TIMEOUT),) + LOCAL_CFLAGS += -DTW_NO_SCREEN_TIMEOUT +endif LOCAL_C_INCLUDES += bionic external/stlport/stlport $(commands_recovery_local_path)/gui/devices/$(DEVICE_RESOLUTION) diff --git a/gui/action.cpp b/gui/action.cpp index ee3373154..d67e697b0 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -40,8 +40,9 @@ #include "../openrecoveryscript.hpp" #include "../adb_install.h" +#ifndef TW_NO_SCREEN_TIMEOUT #include "blanktimer.hpp" - +#endif extern "C" { #include "../twcommon.h" #include "../minuitwrp/minui.h" @@ -59,7 +60,9 @@ int gui_start(); #include "rapidxml.hpp" #include "objects.hpp" +#ifndef TW_NO_SCREEN_TIMEOUT extern blanktimer blankTimer; +#endif void curtainClose(void); @@ -339,7 +342,9 @@ void GUIAction::operation_end(const int operation_status, const int simulate) } DataManager::SetValue("tw_operation_state", 1); DataManager::SetValue(TW_ACTION_BUSY, 0); +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif } int GUIAction::doAction(Action action, int isThreaded /* = 0 */) diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml index 5979c50b0..2b7d20e2e 100755 --- a/gui/devices/1024x600/res/ui.xml +++ b/gui/devices/1024x600/res/ui.xml @@ -2587,6 +2587,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2596,6 +2597,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2603,6 +2605,7 @@ + diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml index 86cfddab4..b625174a4 100644 --- a/gui/devices/1024x768/res/ui.xml +++ b/gui/devices/1024x768/res/ui.xml @@ -2587,6 +2587,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2596,6 +2597,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2603,6 +2605,7 @@ + diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml index e23086ac4..29c8bc303 100644 --- a/gui/devices/1080x1920/res/ui.xml +++ b/gui/devices/1080x1920/res/ui.xml @@ -2598,6 +2598,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2607,6 +2608,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2614,6 +2616,7 @@ + diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml index 4a066a3b1..b86f99171 100644 --- a/gui/devices/1280x800/res/ui.xml +++ b/gui/devices/1280x800/res/ui.xml @@ -2587,6 +2587,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2596,6 +2597,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2603,6 +2605,7 @@ + diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml index 458a72371..157005f1a 100644 --- a/gui/devices/1920x1200/res/ui.xml +++ b/gui/devices/1920x1200/res/ui.xml @@ -2587,6 +2587,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2596,6 +2597,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2603,6 +2605,7 @@ + diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml index 6a77a4fc1..3d6b65f5c 100644 --- a/gui/devices/2560x1600/res/ui.xml +++ b/gui/devices/2560x1600/res/ui.xml @@ -2587,6 +2587,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2596,6 +2597,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2603,6 +2605,7 @@ + diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml index 041a1356b..0719a942c 100644 --- a/gui/devices/320x480/res/ui.xml +++ b/gui/devices/320x480/res/ui.xml @@ -2585,6 +2585,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2594,6 +2595,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2601,6 +2603,7 @@ + diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml index 2b428b40e..b7b527bb9 100644 --- a/gui/devices/480x800/res/ui.xml +++ b/gui/devices/480x800/res/ui.xml @@ -2585,6 +2585,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2594,6 +2595,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2601,6 +2603,7 @@ + diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml index f8d6da167..cb6577f20 100644 --- a/gui/devices/480x854/res/ui.xml +++ b/gui/devices/480x854/res/ui.xml @@ -2584,6 +2584,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2593,6 +2594,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2600,6 +2602,7 @@ + diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml index 7448ddf6e..078f1ae51 100644 --- a/gui/devices/540x960/res/ui.xml +++ b/gui/devices/540x960/res/ui.xml @@ -2585,6 +2585,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2594,6 +2595,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2601,6 +2603,7 @@ + diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml index 2319c555b..d2896cc94 100644 --- a/gui/devices/720x1280/res/ui.xml +++ b/gui/devices/720x1280/res/ui.xml @@ -2598,6 +2598,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2607,6 +2608,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2614,6 +2616,7 @@ + diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml index 692c736c7..ba7dba321 100755 --- a/gui/devices/800x1280/res/ui.xml +++ b/gui/devices/800x1280/res/ui.xml @@ -2586,6 +2586,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2595,6 +2596,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2602,6 +2604,7 @@ + diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml index 768f246f1..ba262bcce 100755 --- a/gui/devices/800x480/res/ui.xml +++ b/gui/devices/800x480/res/ui.xml @@ -2595,6 +2595,7 @@ + Enable screen timeout. tw_screen_timeout_secs=60 @@ -2604,6 +2605,7 @@ + Enable screen timeout. tw_screen_timeout_secs=0 @@ -2611,6 +2613,7 @@ + diff --git a/gui/gui.cpp b/gui/gui.cpp index 821c7f5b2..6ee29d57b 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -47,7 +47,9 @@ extern "C" #include "../variables.h" #include "../partitions.hpp" #include "../twrp-functions.hpp" +#ifndef TW_NO_SCREEN_TIMEOUT #include "blanktimer.hpp" +#endif const static int CURTAIN_FADE = 32; @@ -62,7 +64,9 @@ static int gForceRender = 0; pthread_mutex_t gForceRendermutex; static int gNoAnimation = 1; static int gGuiInputRunning = 0; +#ifndef TW_NO_SCREEN_TIMEOUT blanktimer blankTimer; +#endif // Needed by pages.cpp too int gGuiRunning = 0; @@ -167,6 +171,7 @@ void curtainClose() static void * input_thread(void *cookie) { + int drag = 0; static int touch_and_hold = 0, dontwait = 0; static int touch_repeat = 0, key_repeat = 0; @@ -176,10 +181,14 @@ static void * input_thread(void *cookie) HardwareKeyboard kb; string seconds; +#ifndef TW_NO_SCREEN_TIMEOUT //start screen timeout threads blankTimer.setTimerThread(); DataManager::GetValue("tw_screen_timeout_secs", seconds); blankTimer.setTime(atoi(seconds.c_str())); +#else + LOGINFO("Skipping screen timeout threads: TW_NO_SCREEN_TIMEOUT is set\n"); +#endif for (;;) { @@ -208,7 +217,9 @@ static void * input_thread(void *cookie) LOGERR("TOUCH_HOLD: %d,%d\n", x, y); #endif PageManager::NotifyTouch(TOUCH_HOLD, x, y); +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif } else if (touch_repeat && mtime > 100) { @@ -217,7 +228,9 @@ static void * input_thread(void *cookie) #endif gettimeofday(&touchStart, NULL); PageManager::NotifyTouch(TOUCH_REPEAT, x, y); +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif } else if (key_repeat == 1 && mtime > 500) { @@ -227,7 +240,10 @@ static void * input_thread(void *cookie) gettimeofday(&touchStart, NULL); key_repeat = 2; kb.KeyRepeat(); +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif + } else if (key_repeat == 2 && mtime > 100) { @@ -236,7 +252,9 @@ static void * input_thread(void *cookie) #endif gettimeofday(&touchStart, NULL); kb.KeyRepeat(); +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif } } else if (ev.type == EV_ABS) @@ -253,7 +271,9 @@ static void * input_thread(void *cookie) LOGERR("TOUCH_RELEASE: %d,%d\n", x, y); #endif PageManager::NotifyTouch(TOUCH_RELEASE, x, y); +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif touch_and_hold = 0; touch_repeat = 0; if (!key_repeat) @@ -276,7 +296,9 @@ static void * input_thread(void *cookie) dontwait = 1; key_repeat = 0; gettimeofday(&touchStart, NULL); +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif } else { @@ -288,7 +310,9 @@ static void * input_thread(void *cookie) if (PageManager::NotifyTouch(TOUCH_DRAG, x, y) > 0) state = 1; key_repeat = 0; +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif } } } @@ -309,7 +333,9 @@ static void * input_thread(void *cookie) touch_repeat = 0; dontwait = 1; gettimeofday(&touchStart, NULL); +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif } else { @@ -317,7 +343,9 @@ static void * input_thread(void *cookie) touch_and_hold = 0; touch_repeat = 0; dontwait = 0; +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif } } else @@ -328,7 +356,9 @@ static void * input_thread(void *cookie) touch_and_hold = 0; touch_repeat = 0; dontwait = 0; +#ifndef TW_NO_SCREEN_TIMEOUT blankTimer.resetTimerAndUnblank(); +#endif } } } diff --git a/gui/pages.cpp b/gui/pages.cpp index 9aea1b85a..2bb70e170 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -41,10 +41,14 @@ extern "C" { #include "rapidxml.hpp" #include "objects.hpp" +#ifndef TW_NO_SCREEN_TIMEOUT #include "blanktimer.hpp" +#endif extern int gGuiRunning; +#ifndef TW_NO_SCREEN_TIMEOUT extern blanktimer blankTimer; +#endif std::map PageManager::mPageSets; PageSet* PageManager::mCurrentSet; @@ -919,9 +923,10 @@ int PageManager::Render(void) int PageManager::Update(void) { +#ifndef TW_NO_SCREEN_TIMEOUT if(blankTimer.IsScreenOff()) return 0; - +#endif return (mCurrentSet ? mCurrentSet->Update() : -1); } -- cgit v1.2.3