livedisplay: Check current state before toggling AF/SE
This prevents us from sending unexpected panel commands. Fixes: https://gitlab.com/LineageOS/issues/android/-/issues/4790 Change-Id: I97c5a008f242c861cafdec392b19ab9435a5239b
This commit is contained in:
@@ -33,7 +33,8 @@ Return<bool> AntiFlicker::isEnabled() {
|
||||
|
||||
Return<bool> AntiFlicker::setEnabled(bool enabled) {
|
||||
unsigned int value = enabled;
|
||||
return ioctl(mOplusDisplayFd, PANEL_IOCTL_SET_DIMLAYER_BL_EN, &value) == 0;
|
||||
return isEnabled() == enabled ||
|
||||
ioctl(mOplusDisplayFd, PANEL_IOCTL_SET_DIMLAYER_BL_EN, &value) == 0;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -33,7 +33,7 @@ Return<bool> SunlightEnhancement::isEnabled() {
|
||||
|
||||
Return<bool> SunlightEnhancement::setEnabled(bool enabled) {
|
||||
unsigned int value = enabled;
|
||||
return ioctl(mOplusDisplayFd, PANEL_IOCTL_SET_HBM, &value) == 0;
|
||||
return isEnabled() == enabled || ioctl(mOplusDisplayFd, PANEL_IOCTL_SET_HBM, &value) == 0;
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
Reference in New Issue
Block a user