From 72c62260b995117acb58020700282914695249cd Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sat, 30 Jan 2021 22:57:53 +0100 Subject: [PATCH] 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 --- rw-system.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rw-system.sh b/rw-system.sh index cacda06..0372b10 100644 --- a/rw-system.sh +++ b/rw-system.sh @@ -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