diff --git a/recovery_ui/ui.cpp b/recovery_ui/ui.cpp index eb87f526..8bc02444 100644 --- a/recovery_ui/ui.cpp +++ b/recovery_ui/ui.cpp @@ -43,24 +43,30 @@ using namespace std::chrono_literals; constexpr int UI_WAIT_KEY_TIMEOUT_SEC = 120; -constexpr const char* BRIGHTNESS_FILE = "/sys/class/leds/lcd-backlight/brightness"; -constexpr const char* MAX_BRIGHTNESS_FILE = "/sys/class/leds/lcd-backlight/max_brightness"; +constexpr const char* DEFAULT_BRIGHTNESS_FILE = "/sys/class/leds/lcd-backlight/brightness"; +constexpr const char* DEFAULT_MAX_BRIGHTNESS_FILE = "/sys/class/leds/lcd-backlight/max_brightness"; constexpr const char* BRIGHTNESS_FILE_SDM = "/sys/class/backlight/panel0-backlight/brightness"; constexpr const char* MAX_BRIGHTNESS_FILE_SDM = "/sys/class/backlight/panel0-backlight/max_brightness"; -constexpr const char* BRIGHTNESS_FILE_PWM = - "/sys/class/backlight/pwm-backlight.0/brightness"; +constexpr const char* BRIGHTNESS_FILE_PWM = "/sys/class/backlight/pwm-backlight.0/brightness"; constexpr const char* MAX_BRIGHTNESS_FILE_PWM = "/sys/class/backlight/pwm-backlight.0/max_brightness"; constexpr int kDefaultTouchLowThreshold = 50; constexpr int kDefaultTouchHighThreshold = 90; +constexpr int kDefaultNormalBrightnessPercent = 50; +constexpr int kDefaultDimmedBrightnessPercent = 25; + RecoveryUI::RecoveryUI() - : brightness_normal_(50), - brightness_dimmed_(25), - brightness_file_(BRIGHTNESS_FILE), - max_brightness_file_(MAX_BRIGHTNESS_FILE), + : brightness_normal_(android::base::GetIntProperty("ro.recovery.ui.brightness_normal_percent", + kDefaultNormalBrightnessPercent)), + brightness_dimmed_(android::base::GetIntProperty("ro.recovery.ui.brightness_dimmed_percent", + kDefaultDimmedBrightnessPercent)), + brightness_file_( + android::base::GetProperty("ro.recovery.ui.brightness_file", DEFAULT_BRIGHTNESS_FILE)), + max_brightness_file_(android::base::GetProperty("ro.recovery.ui.max_brightness_file", + DEFAULT_MAX_BRIGHTNESS_FILE)), touch_screen_allowed_(false), fastbootd_logo_enabled_(false), touch_low_threshold_(android::base::GetIntProperty("ro.recovery.ui.touch_low_threshold",