add magic property.* value for accessing system property variables

Change-Id: Ic916da6e7ecbf79396febfe1e5f0b0ae8570083f
diff --git a/data.cpp b/data.cpp
index 52457df..a032d40 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 @@
 	// 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 @@
 	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;