diff --git a/phh-prop-handler.sh b/phh-prop-handler.sh index ba0e0b7..e1eea4a 100644 --- a/phh-prop-handler.sh +++ b/phh-prop-handler.sh @@ -52,6 +52,15 @@ xiaomi_toggle_dt2w_event_node() { return 1 } + +restartAudio() { + setprop ctl.restart audioserver + audioHal="$(getprop |sed -nE 's/.*init\.svc\.(.*audio-hal[^]]*).*/\1/p')" + setprop ctl.restart "$audioHal" + setprop ctl.restart vendor.audio-hal-2-0 + setprop ctl.restart audio-hal-2-0 +} + if [ "$1" == "persist.sys.phh.xiaomi.dt2w" ]; then if [[ "$prop_value" != "0" && "$prop_value" != "1" ]]; then exit 1 @@ -90,3 +99,33 @@ if [ "$1" == "persist.sys.phh.oppo.usbotg" ]; then echo "$prop_value" >/sys/class/power_supply/usb/otg_switch exit fi + +if [ "$1" == "persist.sys.phh.disable_audio_effects" ];then + if [[ "$prop_value" != "0" && "$prop_value" != "1" ]]; then + exit 1 + fi + + if [[ "$prop_value" == 1 ]];then + resetprop ro.audio.ignore_effects true + else + resetprop --delete ro.audio.ignore_effects + fi + restartAudio + exit +fi + +if [ "$1" == "persist.sys.phh.caf.audio_policy" ];then + if [[ "$prop_value" != "0" && "$prop_value" != "1" ]]; then + exit 1 + fi + + if [[ "$prop_value" == 1 ]];then + umount /vendor/etc/audio + mount /audio_policy_configuration.xml /vendor/etc/audio_policy_configuration.xml + else + umount /vendor/etc/audio_policy_configuration.xml + mount /mnt/phh/empty_dir /vendor/etc/audio + fi + restartAudio + exit +fi diff --git a/vndk.rc b/vndk.rc index b6f12fd..a2e343a 100644 --- a/vndk.rc +++ b/vndk.rc @@ -34,3 +34,10 @@ on property:persist.sys.phh.oppo.usbotg=* on property:persist.sys.phh.xiaomi.dt2w=* exec u:r:phhsu_daemon:s0 root -- /system/bin/phh-prop-handler.sh "persist.sys.phh.xiaomi.dt2w" + +on property:persist.sys.phh.disable_audio_effects=* + exec u:r:phhsu_daemon:s0 root -- /system/bin/phh-prop-handler.sh "persist.sys.phh.disable_audio_effects" + +on property:persist.sys.phh.caf.audio_policy=* + exec u:r:phhsu_daemon:s0 root -- /system/bin/phh-prop-handler.sh "persist.sys.phh.caf.audio_policy" +