Fix setting of brightness during startup
Change-Id: I1bd01df971857a2dd5e75ed87c488d075d765527
This commit is contained in:
committed by
Gerrit Code Review
parent
1b7a31bd65
commit
a18f108e84
@@ -51,6 +51,10 @@
|
||||
#include "cutils/properties.h"
|
||||
#endif
|
||||
|
||||
#ifndef TW_MAX_BRIGHTNESS
|
||||
#define TW_MAX_BRIGHTNESS 255
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "twcommon.h"
|
||||
@@ -946,9 +950,6 @@ void DataManager::SetDefaultValues()
|
||||
mValues.insert(make_pair("tw_gui_done", make_pair("0", 0)));
|
||||
mValues.insert(make_pair("tw_encrypt_backup", make_pair("0", 0)));
|
||||
#ifdef TW_BRIGHTNESS_PATH
|
||||
#ifndef TW_MAX_BRIGHTNESS
|
||||
#define TW_MAX_BRIGHTNESS 255
|
||||
#endif
|
||||
string findbright;
|
||||
if (strcmp(EXPAND(TW_BRIGHTNESS_PATH), "/nobrightness") != 0) {
|
||||
findbright = EXPAND(TW_BRIGHTNESS_PATH);
|
||||
@@ -975,6 +976,8 @@ void DataManager::SetDefaultValues()
|
||||
mConstValues.insert(make_pair("tw_brightness_max", maxVal.str()));
|
||||
mValues.insert(make_pair("tw_brightness", make_pair(maxVal.str(), 1)));
|
||||
mValues.insert(make_pair("tw_brightness_pct", make_pair("100", 1)));
|
||||
string max_bright = maxVal.str();
|
||||
TWFunc::write_file(findbright, max_bright);
|
||||
}
|
||||
#endif
|
||||
mValues.insert(make_pair(TW_MILITARY_TIME, make_pair("0", 1)));
|
||||
@@ -1136,13 +1139,12 @@ void DataManager::ReadSettingsFile(void)
|
||||
#endif // ifdef TW_OEM_BUILD
|
||||
PartitionManager.Mount_All_Storage();
|
||||
update_tz_environment_variables();
|
||||
#ifdef TW_MAX_BRIGHTNESS
|
||||
if (strcmp(EXPAND(TW_BRIGHTNESS_PATH), "/nobrightness") != 0) {
|
||||
string brightness_path = EXPAND(TW_BRIGHTNESS_PATH);
|
||||
|
||||
string brightness_path = GetStrValue("tw_brightness_file");
|
||||
if (!brightness_path.empty() && brightness_path != "/nobrightness" && TWFunc::Path_Exists(brightness_path)) {
|
||||
string brightness_value = GetStrValue("tw_brightness");
|
||||
TWFunc::write_file(brightness_path, brightness_value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
string DataManager::GetCurrentStoragePath(void)
|
||||
|
||||
Reference in New Issue
Block a user