Fix backlight on some Samsung devices

Some Samsung Q vendor devices have HWC rather than lights hal control.
In those cases, backlight is controlled through another SELinux context.
We used to correct this SELinux context for all devices, however this is
no longer needed, and actually breaks those devices.

So, change SELinux context, only if uid/gid is wrong
This commit is contained in:
Pierre-Hugues Husson 2021-01-30 22:57:53 +01:00
parent c7438a5be6
commit 72c62260b9
1 changed files with 5 additions and 3 deletions

View File

@ -816,9 +816,11 @@ fi
if getprop ro.vendor.build.fingerprint |grep -qiE '^samsung/';then
for f in /sys/class/lcd/panel/actual_mask_brightness /sys/class/lcd/panel/mask_brightness /sys/class/lcd/panel/device/backlight/panel/brightness /sys/class/backlight/panel0-backlight/brightness;do
chcon u:object_r:sysfs_lcd_writable:s0 $f
chmod 0644 $f
chown system:system $f
if [ "$(stat -c '%U' "$f")" == "root" ];then
chcon u:object_r:sysfs_lcd_writable:s0 $f
chmod 0644 $f
chown system:system $f
fi
done
setprop persist.sys.phh.fod.samsung true