Add support for controlling recovery brightness at exynos-compatible sysfs path
Test: manual Bug: 139537581 Exempt-From-Owner-Approval: wear branch Change-Id: I163ea0d5e716c9fad28fb2c64306ed24362c53c7 (cherry picked from commit c9c5fcf8d6c9a6be7a5e07bcf94a3f841eaaca25) (cherry picked from commit 526bd581bca75f93778eb773674773de21fe8f54)
This commit is contained in:
parent
01e576e61a
commit
fcf4b6bca0
1 changed files with 15 additions and 2 deletions
|
@ -48,6 +48,10 @@ constexpr const char* MAX_BRIGHTNESS_FILE = "/sys/class/leds/lcd-backlight/max_b
|
|||
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* MAX_BRIGHTNESS_FILE_PWM =
|
||||
"/sys/class/backlight/pwm-backlight.0/max_brightness";
|
||||
|
||||
constexpr int kDefaultTouchLowThreshold = 50;
|
||||
constexpr int kDefaultTouchHighThreshold = 90;
|
||||
|
@ -106,10 +110,19 @@ bool RecoveryUI::InitScreensaver() {
|
|||
return false;
|
||||
}
|
||||
if (access(brightness_file_.c_str(), R_OK | W_OK)) {
|
||||
brightness_file_ = BRIGHTNESS_FILE_SDM;
|
||||
if (!access(BRIGHTNESS_FILE_SDM, R_OK | W_OK)) {
|
||||
brightness_file_ = BRIGHTNESS_FILE_SDM;
|
||||
} else {
|
||||
brightness_file_ = BRIGHTNESS_FILE_PWM;
|
||||
}
|
||||
}
|
||||
|
||||
if (access(max_brightness_file_.c_str(), R_OK)) {
|
||||
max_brightness_file_ = MAX_BRIGHTNESS_FILE_SDM;
|
||||
if (!access(MAX_BRIGHTNESS_FILE_SDM, R_OK)) {
|
||||
max_brightness_file_ = MAX_BRIGHTNESS_FILE_SDM;
|
||||
} else {
|
||||
max_brightness_file_ = MAX_BRIGHTNESS_FILE_PWM;
|
||||
}
|
||||
}
|
||||
// Set the initial brightness level based on the max brightness. Note that reading the initial
|
||||
// value from BRIGHTNESS_FILE doesn't give the actual brightness value (bullhead, sailfish), so
|
||||
|
|
Loading…
Reference in a new issue