Add properties to use vendor audio policy, and to disable audio effects

This commit is contained in:
Pierre-Hugues Husson 2020-05-03 18:05:30 +02:00
parent bad4131180
commit 0ae6b5b05c
2 changed files with 46 additions and 0 deletions

View File

@ -52,6 +52,15 @@ xiaomi_toggle_dt2w_event_node() {
return 1 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 [ "$1" == "persist.sys.phh.xiaomi.dt2w" ]; then
if [[ "$prop_value" != "0" && "$prop_value" != "1" ]]; then if [[ "$prop_value" != "0" && "$prop_value" != "1" ]]; then
exit 1 exit 1
@ -90,3 +99,33 @@ if [ "$1" == "persist.sys.phh.oppo.usbotg" ]; then
echo "$prop_value" >/sys/class/power_supply/usb/otg_switch echo "$prop_value" >/sys/class/power_supply/usb/otg_switch
exit exit
fi 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

View File

@ -34,3 +34,10 @@ on property:persist.sys.phh.oppo.usbotg=*
on property:persist.sys.phh.xiaomi.dt2w=* 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" 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"