summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Android.mk9
-rw-r--r--data.cpp49
-rw-r--r--gui/devices/1024x600/res/ui.xml17
-rw-r--r--gui/devices/1024x768/res/ui.xml17
-rw-r--r--gui/devices/1080x1920/res/ui.xml9
-rw-r--r--gui/devices/1200x1920/res/ui.xml9
-rw-r--r--gui/devices/1280x800/res/ui.xml9
-rw-r--r--gui/devices/1440x2560/res/ui.xml15
-rw-r--r--gui/devices/1600x2560/res/ui.xml9
-rw-r--r--gui/devices/1920x1200/res/ui.xml11
-rw-r--r--gui/devices/240x240/res/ui.xml13
-rw-r--r--gui/devices/2560x1600/res/ui.xml9
-rw-r--r--gui/devices/280x280/res/ui.xml11
-rw-r--r--gui/devices/320x320/res/ui.xml11
-rw-r--r--gui/devices/320x480/res/ui.xml11
-rw-r--r--gui/devices/480x800/res/ui.xml11
-rw-r--r--gui/devices/480x854/res/ui.xml11
-rw-r--r--gui/devices/540x960/res/ui.xml11
-rw-r--r--gui/devices/720x1280/res/ui.xml9
-rw-r--r--gui/devices/800x1280/res/ui.xml9
-rw-r--r--gui/devices/800x480/res/ui.xml11
-rw-r--r--twrp-functions.cpp6
-rw-r--r--twrp-functions.hpp1
23 files changed, 255 insertions, 23 deletions
diff --git a/Android.mk b/Android.mk
index 03e1a6962..5ec184e9d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -199,6 +199,9 @@ endif
ifeq ($(TW_NO_BATT_PERCENT), true)
LOCAL_CFLAGS += -DTW_NO_BATT_PERCENT
endif
+ifeq ($(TW_NO_CPU_TEMP), true)
+ LOCAL_CFLAGS += -DTW_NO_CPU_TEMP
+endif
ifneq ($(TW_CUSTOM_POWER_BUTTON),)
LOCAL_CFLAGS += -DTW_CUSTOM_POWER_BUTTON=$(TW_CUSTOM_POWER_BUTTON)
endif
@@ -288,6 +291,12 @@ endif
ifneq ($(TW_CUSTOM_BATTERY_PATH),)
LOCAL_CFLAGS += -DTW_CUSTOM_BATTERY_PATH=$(TW_CUSTOM_BATTERY_PATH)
endif
+ifneq ($(TW_CUSTOM_CPU_TEMP_PATH),)
+ LOCAL_CFLAGS += -DTW_CUSTOM_CPU_TEMP_PATH=$(TW_CUSTOM_CPU_TEMP_PATH)
+endif
+ifneq ($(TW_NO_CPU_TEMP),)
+ LOCAL_CFLAGS += -DTW_NO_CPU_TEMP=$(TW_NO_CPU_TEMP)
+endif
ifneq ($(TW_EXCLUDE_ENCRYPTED_BACKUPS), true)
LOCAL_SHARED_LIBRARIES += libopenaes
else
diff --git a/data.cpp b/data.cpp
index be851584e..0e46b3bdb 100644
--- a/data.cpp
+++ b/data.cpp
@@ -72,6 +72,7 @@ map<string, DataManager::TStrIntPair> DataManager::mValues;
map<string, string> DataManager::mConstValues;
string DataManager::mBackingFile;
int DataManager::mInitialized = 0;
+
#ifndef TW_NO_SCREEN_TIMEOUT
extern blanktimer blankTimer;
#endif
@@ -353,7 +354,6 @@ int DataManager::GetValue(const string varName, string& value)
// Handle magic values
if (GetMagicValue(localStr, value) == 0)
return 0;
-
map<string, string>::iterator constPos;
constPos = mConstValues.find(localStr);
if (constPos != mConstValues.end())
@@ -660,6 +660,23 @@ void DataManager::SetDefaultValues()
#else
mConstValues.insert(make_pair(TW_NO_BATTERY_PERCENT, "0"));
#endif
+#ifdef TW_NO_CPU_TEMP
+ printf("TW_NO_CPU_TEMP := true\n");
+ mConstValues.insert(make_pair("tw_no_cpu_temp", "1"));
+#else
+ string cpu_temp_file;
+#ifdef TW_CUSTOM_CPU_TEMP_PATH
+ cpu_temp_file = EXPAND(TW_CUSTOM_CPU_TEMP_PATH);
+#else
+ cpu_temp_file = "/sys/class/thermal/thermal_zone0/temp";
+#endif
+ if (TWFunc::Path_Exists(cpu_temp_file)) {
+ mConstValues.insert(make_pair("tw_no_cpu_temp", "0"));
+ } else {
+ LOGINFO("CPU temperature file '%s' not found, disabling CPU temp.\n", cpu_temp_file.c_str());
+ mConstValues.insert(make_pair("tw_no_cpu_temp", "1"));
+ }
+#endif
#ifdef TW_CUSTOM_POWER_BUTTON
printf("TW_POWER_BUTTON := %s\n", EXPAND(TW_CUSTOM_POWER_BUTTON));
mConstValues.insert(make_pair(TW_POWER_BUTTON, EXPAND(TW_CUSTOM_POWER_BUTTON)));
@@ -862,13 +879,41 @@ int DataManager::GetMagicValue(const string varName, string& value)
value = tmp;
return 0;
}
+ else if (varName == "tw_cpu_temp")
+ {
+ string cpu_temp_file;
+ static unsigned long convert_temp = 0;
+ static time_t cpuSecCheck = 0;
+ int divisor = 0;
+ struct timeval curTime;
+ string results;
+
+ gettimeofday(&curTime, NULL);
+ if (curTime.tv_sec > cpuSecCheck)
+ {
+#ifdef TW_CUSTOM_CPU_TEMP_PATH
+ cpu_temp_file = EXPAND(TW_CUSTOM_CPU_TEMP_PATH);
+ if (TWFunc::read_file(cpu_temp_file, results) != 0)
+ return -1;
+#else
+ cpu_temp_file = "/sys/class/thermal/thermal_zone0/temp";
+ if (TWFunc::read_file(cpu_temp_file, results) != 0)
+ return -1;
+#endif
+ convert_temp = strtoul(results.c_str(), NULL, 0) / 1000;
+ if (convert_temp <= 0)
+ convert_temp = strtoul(results.c_str(), NULL, 0);
+ cpuSecCheck = curTime.tv_sec + 5;
+ }
+ value = TWFunc::to_string(convert_temp);
+ return 0;
+ }
else if (varName == "tw_battery")
{
char tmp[16];
static char charging = ' ';
static int lastVal = -1;
static time_t nextSecCheck = 0;
-
struct timeval curTime;
gettimeofday(&curTime, NULL);
if (curTime.tv_sec > nextSecCheck)
diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml
index 4d6f3178f..7b7ad8ce7 100644
--- a/gui/devices/1024x600/res/ui.xml
+++ b/gui/devices/1024x600/res/ui.xml
@@ -231,13 +231,13 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="250" y="5" />
+ <placement x="200" y="5" />
<text>Team Win Recovery Project v%tw_version%</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="250" y="30" />
+ <placement x="200" y="30" />
<conditions>
<condition var1="tw_no_battery_percent" var2="0" />
<condition var1="tw_battery" op=">" var2="0" />
@@ -248,14 +248,23 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="450" y="30" />
+ <placement x="400" y="30" />
<text>%tw_time%</text>
</object>
<object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="700" y="30" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
+ <object type="text" color="%text_color%">
<condition var1="tw_simulate_actions" var2="1" />
<font resource="font" />
- <placement x="550" y="30" />
+ <placement x="475" y="30" />
<text>SIMULATING ACTIONS</text>
</object>
diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml
index 29f169089..b5ce1b40b 100644
--- a/gui/devices/1024x768/res/ui.xml
+++ b/gui/devices/1024x768/res/ui.xml
@@ -231,13 +231,13 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="250" y="5" />
+ <placement x="200" y="5" />
<text>Team Win Recovery Project v%tw_version%</text>
</object>
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="250" y="30" />
+ <placement x="200" y="30" />
<conditions>
<condition var1="tw_no_battery_percent" var2="0" />
<condition var1="tw_battery" op=">" var2="0" />
@@ -248,14 +248,23 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="450" y="30" />
+ <placement x="400" y="30" />
<text>%tw_time%</text>
</object>
<object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="700" y="30" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
+ <object type="text" color="%text_color%">
<condition var1="tw_simulate_actions" var2="1" />
<font resource="font" />
- <placement x="550" y="30" />
+ <placement x="475" y="30" />
<text>SIMULATING ACTIONS</text>
</object>
diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml
index 95c48a513..1367015bf 100644
--- a/gui/devices/1080x1920/res/ui.xml
+++ b/gui/devices/1080x1920/res/ui.xml
@@ -246,6 +246,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="760" y="114" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%home_button_x%" y="%home_button_y%" />
diff --git a/gui/devices/1200x1920/res/ui.xml b/gui/devices/1200x1920/res/ui.xml
index 428880d76..77af05ba7 100644
--- a/gui/devices/1200x1920/res/ui.xml
+++ b/gui/devices/1200x1920/res/ui.xml
@@ -249,6 +249,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="730" y="114" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%home_button_x%" y="%home_button_y%" />
diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml
index 6f6c2bd36..716dadc1e 100644
--- a/gui/devices/1280x800/res/ui.xml
+++ b/gui/devices/1280x800/res/ui.xml
@@ -253,6 +253,15 @@
</object>
<object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="850" y="30" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
+ <object type="text" color="%text_color%">
<condition var1="tw_simulate_actions" var2="1" />
<font resource="font" />
<placement x="550" y="30" />
diff --git a/gui/devices/1440x2560/res/ui.xml b/gui/devices/1440x2560/res/ui.xml
index fe55dfdbf..79f12cfce 100644
--- a/gui/devices/1440x2560/res/ui.xml
+++ b/gui/devices/1440x2560/res/ui.xml
@@ -9,9 +9,9 @@
<preview>preview.jpg</preview>
</details>
- <include>
- <xmlfile name="portrait.xml" />
- </include>
+ <include>
+ <xmlfile name="portrait.xml" />
+ </include>
<resources>
<resource name="font" type="font" filename="RobotoCondensed-Regular.ttf" size="50" fallback="Roboto-Condensed-50" />
@@ -246,6 +246,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="839" y="132" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%home_button_x%" y="%home_button_y%" />
diff --git a/gui/devices/1600x2560/res/ui.xml b/gui/devices/1600x2560/res/ui.xml
index 8561b2ddf..09c740866 100644
--- a/gui/devices/1600x2560/res/ui.xml
+++ b/gui/devices/1600x2560/res/ui.xml
@@ -249,6 +249,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="739" y="132" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%home_button_x%" y="%home_button_y%" />
diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml
index 3e8c9f13f..e36d0ae76 100644
--- a/gui/devices/1920x1200/res/ui.xml
+++ b/gui/devices/1920x1200/res/ui.xml
@@ -253,9 +253,18 @@
</object>
<object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="1150" y="40" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
+ <object type="text" color="%text_color%">
<condition var1="tw_simulate_actions" var2="1" />
<font resource="font" />
- <placement x="850" y="40" />
+ <placement x="750" y="40" />
<text>SIMULATING ACTIONS</text>
</object>
diff --git a/gui/devices/240x240/res/ui.xml b/gui/devices/240x240/res/ui.xml
index 294e5951b..d157f85c1 100644
--- a/gui/devices/240x240/res/ui.xml
+++ b/gui/devices/240x240/res/ui.xml
@@ -211,7 +211,7 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="3" y="3" />
+ <placement x="1" y="3" />
<text>TWRP v%tw_version%</text>
</object>
@@ -224,7 +224,7 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="100" y="3" />
+ <placement x="89" y="3" />
<text>%tw_time%</text>
</object>
@@ -238,6 +238,15 @@
</conditions>
<text>%tw_battery%</text>
</object>
+
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="145" y="3" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>%tw_cpu_temp% C</text>
+ </object>
</template>
<template name="header">
diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml
index cb0c12e1f..12a2d5536 100644
--- a/gui/devices/2560x1600/res/ui.xml
+++ b/gui/devices/2560x1600/res/ui.xml
@@ -253,6 +253,15 @@
</object>
<object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="1650" y="55" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
+ <object type="text" color="%text_color%">
<condition var1="tw_simulate_actions" var2="1" />
<font resource="font" />
<placement x="1100" y="55" />
diff --git a/gui/devices/280x280/res/ui.xml b/gui/devices/280x280/res/ui.xml
index 99532edcb..971e6371f 100644
--- a/gui/devices/280x280/res/ui.xml
+++ b/gui/devices/280x280/res/ui.xml
@@ -224,7 +224,7 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="165" y="3" />
+ <placement x="95" y="3" />
<text>%tw_time%</text>
</object>
@@ -238,6 +238,15 @@
</conditions>
<text>%tw_battery%</text>
</object>
+
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="160" y="3" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
</template>
<template name="header">
diff --git a/gui/devices/320x320/res/ui.xml b/gui/devices/320x320/res/ui.xml
index f66852942..4678e855f 100644
--- a/gui/devices/320x320/res/ui.xml
+++ b/gui/devices/320x320/res/ui.xml
@@ -224,7 +224,7 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="200" y="3" />
+ <placement x="110" y="3" />
<text>%tw_time%</text>
</object>
@@ -238,6 +238,15 @@
</conditions>
<text>%tw_battery%</text>
</object>
+
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="190" y="3" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
</template>
<template name="header">
diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml
index cccd5b3b4..dd4cdbc36 100644
--- a/gui/devices/320x480/res/ui.xml
+++ b/gui/devices/320x480/res/ui.xml
@@ -232,7 +232,7 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="165" y="39" />
+ <placement x="135" y="39" />
<conditions>
<condition var1="tw_no_battery_percent" var2="0" />
<condition var1="tw_battery" op=">" var2="0" />
@@ -241,6 +241,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="265" y="39" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>%tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<placement x="%home_button_x%" y="%home_button_y%" />
<font resource="font" color="%button_text_color%" />
diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml
index 940ad4333..0e0f65d70 100644
--- a/gui/devices/480x800/res/ui.xml
+++ b/gui/devices/480x800/res/ui.xml
@@ -232,7 +232,7 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="250" y="70" />
+ <placement x="190" y="70" />
<conditions>
<condition var1="tw_no_battery_percent" var2="0" />
<condition var1="tw_battery" op=">" var2="0" />
@@ -241,6 +241,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="350" y="70" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<placement x="%home_button_x%" y="%home_button_y%" />
<font resource="font" color="%button_text_color%" />
diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml
index dce1d8843..26d8b28d0 100644
--- a/gui/devices/480x854/res/ui.xml
+++ b/gui/devices/480x854/res/ui.xml
@@ -231,7 +231,7 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="250" y="70" />
+ <placement x="190" y="70" />
<conditions>
<condition var1="tw_no_battery_percent" var2="0" />
<condition var1="tw_battery" op=">" var2="0" />
@@ -240,6 +240,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="350" y="70" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<placement x="%home_button_x%" y="%home_button_y%" />
<font resource="font" color="%button_text_color%" />
diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml
index 37c3e26d5..dc647ce60 100644
--- a/gui/devices/540x960/res/ui.xml
+++ b/gui/devices/540x960/res/ui.xml
@@ -232,7 +232,7 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="250" y="70" />
+ <placement x="200" y="70" />
<conditions>
<condition var1="tw_no_battery_percent" var2="0" />
<condition var1="tw_battery" op=">" var2="0" />
@@ -241,6 +241,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="400" y="70" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<placement x="%home_button_x%" y="%home_button_y%" />
<font resource="font" color="%button_text_color%" />
diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml
index a7ff19285..2f1fbc7c5 100644
--- a/gui/devices/720x1280/res/ui.xml
+++ b/gui/devices/720x1280/res/ui.xml
@@ -246,6 +246,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="500" y="76" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<highlight color="%highlight_color%" />
<placement x="%home_button_x%" y="%home_button_y%" />
diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml
index e0036bfc5..03b6144fc 100644
--- a/gui/devices/800x1280/res/ui.xml
+++ b/gui/devices/800x1280/res/ui.xml
@@ -243,6 +243,15 @@
<text>Battery: %tw_battery%</text>
</object>
+ <object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="420" y="76" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
<object type="button">
<placement x="%home_button_x%" y="%home_button_y%" />
<font resource="font" color="%button_text_color%" />
diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml
index 9acb7a112..ed1c84271 100644
--- a/gui/devices/800x480/res/ui.xml
+++ b/gui/devices/800x480/res/ui.xml
@@ -248,11 +248,20 @@
<object type="text" color="%text_color%">
<font resource="font" />
- <placement x="450" y="37" />
+ <placement x="425" y="37" />
<text>%tw_time%</text>
</object>
<object type="text" color="%text_color%">
+ <font resource="font" />
+ <placement x="500" y="37" />
+ <conditions>
+ <condition var1="tw_no_cpu_temp" var2="0" />
+ </conditions>
+ <text>CPU: %tw_cpu_temp% C</text>
+ </object>
+
+ <object type="text" color="%text_color%">
<condition var1="tw_simulate_actions" var2="1" />
<font resource="font" />
<placement x="250" y="20" />
diff --git a/twrp-functions.cpp b/twrp-functions.cpp
index cd8700f8f..89714dd7d 100644
--- a/twrp-functions.cpp
+++ b/twrp-functions.cpp
@@ -1289,4 +1289,10 @@ void TWFunc::SetPerformanceMode(bool mode) {
usleep(500000);
}
+std::string TWFunc::to_string(unsigned long value) {
+ std::ostringstream os;
+ os << value;
+ return os.str();
+}
+
#endif // ndef BUILD_TWRPTAR_MAIN
diff --git a/twrp-functions.hpp b/twrp-functions.hpp
index de14d943f..1cc531c79 100644
--- a/twrp-functions.hpp
+++ b/twrp-functions.hpp
@@ -86,6 +86,7 @@ public:
static bool Create_Dir_Recursive(const std::string& path, mode_t mode = 0755, uid_t uid = -1, gid_t gid = -1); // Create directory and it's parents, if they don't exist. mode, uid and gid are set to all _newly_ created folders. If whole path exists, do nothing.
static int Set_Brightness(std::string brightness_value); // Well, you can read, it does what it says, passing return int from TWFunc::Write_File ;)
static bool Toggle_MTP(bool enable); // Disables MTP if enable is false and re-enables MTP if enable is true and it was enabled the last time it was toggled off
+ static std::string to_string(unsigned long value); //convert ul to string
static void SetPerformanceMode(bool mode); // support recovery.perf.mode