Read brightness-related properties from ro.recovery.ui

This allows configurable brightness levels and file paths through
BoardConfig.

Bug: 221048336
Test: brightness file paths and levels are successfully overwritten on
devices that don't use default values.

Change-Id: I357dc58b7b3d9784554c68cbb86fe345a5587735
This commit is contained in:
Chuong Hoang 2023-06-30 04:38:53 +00:00
parent c4e7b82c44
commit 0b6c017613

View file

@ -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",