summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXuefer <xuefer@gmail.com>2015-03-26 15:45:04 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-06-17 23:38:08 +0200
commita163f15eec024127d0b4cfdf1bd2ec5dd09c717d (patch)
treef8de11216fddc0b29ad92cedc5fbd0b6305b30d6
parentminuitwrp: fix crash when taking a screenshot. (diff)
downloadandroid_bootable_recovery-a163f15eec024127d0b4cfdf1bd2ec5dd09c717d.tar
android_bootable_recovery-a163f15eec024127d0b4cfdf1bd2ec5dd09c717d.tar.gz
android_bootable_recovery-a163f15eec024127d0b4cfdf1bd2ec5dd09c717d.tar.bz2
android_bootable_recovery-a163f15eec024127d0b4cfdf1bd2ec5dd09c717d.tar.lz
android_bootable_recovery-a163f15eec024127d0b4cfdf1bd2ec5dd09c717d.tar.xz
android_bootable_recovery-a163f15eec024127d0b4cfdf1bd2ec5dd09c717d.tar.zst
android_bootable_recovery-a163f15eec024127d0b4cfdf1bd2ec5dd09c717d.zip
-rw-r--r--data.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/data.cpp b/data.cpp
index 52457df8f..a032d40cd 100644
--- a/data.cpp
+++ b/data.cpp
@@ -48,9 +48,7 @@
#include "find_file.hpp"
#include "set_metadata.h"
-#ifdef TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID
- #include "cutils/properties.h"
-#endif
+#include "cutils/properties.h"
#ifndef TW_MAX_BRIGHTNESS
#define TW_MAX_BRIGHTNESS 255
@@ -367,6 +365,15 @@ int DataManager::GetValue(const string varName, string& value)
// Handle magic values
if (GetMagicValue(localStr, value) == 0)
return 0;
+
+ // Handle property
+ if (localStr.length() > 9 && localStr.substr(0, 9) == "property.") {
+ char property_value[PROPERTY_VALUE_MAX];
+ property_get(localStr.substr(9).c_str(), property_value, "");
+ value = property_value;
+ return 0;
+ }
+
map<string, string>::iterator constPos;
constPos = mConstValues.find(localStr);
if (constPos != mConstValues.end())
@@ -444,6 +451,14 @@ int DataManager::SetValue(const string varName, string value, int persist /* = 0
if (!mInitialized)
SetDefaultValues();
+ // Handle property
+ if (varName.length() > 9 && varName.substr(0, 9) == "property.") {
+ int ret = property_set(varName.substr(9).c_str(), value.c_str());
+ if (ret)
+ LOGERR("Error setting property '%s' to '%s'\n", varName.substr(9).c_str(), value.c_str());
+ return ret;
+ }
+
// Don't allow empty values or numerical starting values
if (varName.empty() || (varName[0] >= '0' && varName[0] <= '9'))
return -1;