From 843c0ec80afa8d942563d14871ace27ff34edd11 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sun, 6 Dec 2020 00:58:01 +0100 Subject: [PATCH] Add persist.sys.phh.backlight.scale to control brightness scale from treble app --- phh-prop-handler.sh | 17 +++++++++++++++++ vndk.rc | 3 +++ 2 files changed, 20 insertions(+) diff --git a/phh-prop-handler.sh b/phh-prop-handler.sh index 722b569..42b40c9 100644 --- a/phh-prop-handler.sh +++ b/phh-prop-handler.sh @@ -143,3 +143,20 @@ if [ "$1" == "persist.sys.phh.vsmart.dt2w" ];then fi exit fi + +if [ "$1" == "persist.sys.phh.backlight.scale" ];then + if [[ "$prop_value" != "0" && "$prop_value" != "1" ]]; then + exit 1 + fi + + if [[ "$prop_value" == 1 ]];then + if [ -f /sys/class/leds/lcd-backlight/max_brightness ];then + setprop persist.sys.qcom-brightness "$(cat /sys/class/leds/lcd-backlight/max_brightness)" + elif [ -f /sys/class/backlight/panel0-backlight/max_brightness ];then + setprop persist.sys.qcom-brightness "$(cat /sys/class/backlight/panel0-backlight/max_brightness)" + fi + else + setprop persist.sys.qcom-brightness -1 + fi + exit +fi diff --git a/vndk.rc b/vndk.rc index 334a492..001e8dd 100644 --- a/vndk.rc +++ b/vndk.rc @@ -44,6 +44,9 @@ on property:persist.sys.phh.caf.audio_policy=* on property:persist.sys.phh.vsmart.dt2w=* exec u:r:phhsu_daemon:s0 root -- /system/bin/phh-prop-handler.sh "persist.sys.phh.vsmart.dt2w" +on property:persist.sys.phh.backlight.scale=* + exec u:r:phhsu_daemon:s0 root -- /system/bin/phh-prop-handler.sh "persist.sys.phh.backlight.scale" + on property:ro.sf.lcd_density=* restart surfaceflinger